Function types versus arrays

Alex Buckley Alex.Buckley at Sun.COM
Fri Feb 12 14:20:43 PST 2010


Rémi Forax wrote:
> Le 12/02/2010 17:33, Neal Gafter a écrit :
>> MethodHandle can be a subtype of every function type?  I think you
>> mean supertype, not subtype?  
> 
> Yes, MethodHandle is a supertype of all function type.

OK ... and then, MethodHandle objects can be safely stored in a 
function-typed array because of your translation scheme:

> In that case, the following code is legal:
>    #int(int)[] array = (#int(int)[])new MethodHandle[10];
> but the cast will raise a warning.
> Because function type are translated at compile time
> to MethodHandle, no ClassCastException at runtime.

But can you show me how an array of MethodHandles performs dynamic 
typechecking at array store?

Alex


More information about the lambda-dev mailing list