lambda or reified lambda
Maurizio.Cimadamore at Sun.COM
Wed Nov 18 13:32:09 PST 2009
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.
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].
> What is the reason to not use method handle to implement lambdas ?
> You will get reification for free.
More information about the closures-dev