lambda or reified lambda

Rémi Forax forax at univ-mlv.fr
Wed Nov 18 14:01:43 PST 2009


Le 18/11/2009 22:32, Maurizio Cimadamore a écrit :
> Rémi Forax wrote:
>> Hi Neal,
>> I've just read your new proposal for lambda in Java (v0.6a).
>>
>> A small remarks, I think that defined @Shared as an annotation
>> is not necessary. 'shared' as a local keyword should be better.
>>
>> Your proposal doesn't say that function types are not reified:
>>    #int(String) fun = #(String text) text.length();
>>    #int(Object) fun2 = fun; // ok, subtyping
>>
>>    #int(String) fun3 = (#int(String))fun2; // unsafe warning.
> Hi
> I think it's the other way around - you can go from #int(Object) to 
> #int(String) but not from #int(String) to #int(Object) [subtyping 
> between parameter types is contravariant].
>
> Maurizio

Oups sorry,
I mean:

#int(Object) fun = #(Object o) o.toString().length();
#int(String) fun2 = fun; // ok, subtyping

#int(Object) fun3 = (#int(Object))fun2; // unsafe warning.


>>
>> What is the reason to not use method handle to implement lambdas ?
>> You will get reification for free.
>>
>> regards,
>> Rémi
>>
>>
>>
>

Rémi



More information about the closures-dev mailing list