logo       

Re: java.lang.reflect.Array considered harmful?: msg#00035

lang.jruby.user

Subject: Re: java.lang.reflect.Array considered harmful?

I think perhaps we should treat Java type arrays as their own types
that look and act like arrays. Since they're strongly typed there's
always going to be additional restrictions on their contents we just
can't avoid. They'll never be "just another Ruby array", and perhaps
that's ok considering the very specific scenarios in which we'll need
them. So perhaps something like:

include_class("java.lang.String") {|p,c| "J" + n}
str_array = JString::Array.new(size)
str_array << "foo"
str_array.length => size
...etc

And for the primitive types, perhaps require 'java' should
automatically create some proxies/factories for those:

JavaInt.new(5) => a java.lang.Integer that we treat like a primitive int
JavaInt::Array.new(5) => an array-like wrapper for an array of int

On 2/14/06, Thomas E Enebo <enebo@xxxxxxx> wrote:
> On Tue, 14 Feb 2006, Werner Schuster (murphee) defenestrated me:
> I have recently ran into how unwieldy it is to deal with java
> arrays and would like to consider other mechanisms for this. Even
> if it is just a convenience method.
>
> If I remember right we have no way of making an array of primitives.
> So this area needs some work anyways...
>
> -Tom
>
> --
> + http://www.tc.umn.edu/~enebo +---- mailto:enebo@xxxxxxx ----+
> | Thomas E Enebo, Protagonist | "Luck favors the prepared |
> | | mind." -Louis Pasteur |
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Jruby-user mailing list
> Jruby-user@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/jruby-user
>


--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise