Function types versus arrays
Doug Lea
dl at cs.oswego.edu
Tue Feb 9 09:02:29 PST 2010
Alex Buckley wrote:
> Neal raises a fair point. I recognize that arrays of function types are
> as potentially unsafe at runtime as arrays of non-wildcard parameterized
> types.
>
Alternatively, the array botch itself could be addressed
by creating an efficient Array class tightly coupled
to the compiler and VM.
(I confess that every time I use an array that ought
to be generic (which is quite often), I think unkind
thoughts about Java, and myself for letting it happen.)
As a special bonus, class java.lang.Array could
* Allow "[]" syntax, just like Project Coin maps
* Allow "long" indices, which are needed anyway.
A reasonably simple implementation is available via
Unsafe (which is a defacto standard so unlikely
to be controversial), although it would need tighter
integration to be good enough to use without having to
manually validate decent performance in practice.
Probably the main challenge is for Garbage Collectors,
that don't know what to do with giant arrays.
-Doug
More information about the lambda-dev
mailing list