Lambda and JSR 292 method handle (a prototype)
Rémi Forax
forax at univ-mlv.fr
Sun Dec 27 12:33:27 PST 2009
Le 27/12/2009 18:57, Neal Gafter a écrit :
> Rémi-
>
> In Types.java, you seem to mark most function types as reifiable, but
> your mapping (erasure) does not in fact reify them. Am I missing
> something?
It's a prototype. What I would like is to implement instantiation of
generics in function type
as a conversion that will create a new reified lambda from a generic non
refied lambda.
But I haven't yet implement it.
I think there is also a problem with array of function types because
they should not be reifiable.
>
> Also, your selected syntax for lambda expressions would be ambiguous
> with shorthand invocation. The expression "lambda()(2)" can either be
> a lambda expression of no arguments whose result is 2, or an
> invocation of a method named lambda with no arguments, and then
> applying the resulting function value to the single argument 2.
No, because the prototype use .invoke() to call a function type.
lambda()(2) is a lambda expression that return 2.
An invocation of a method named lambda with no argument
that return a function type should use invoke:
private static #void(int) lambda() {
return lambda(int x) {
System.out.println(x);
};
}
lambda().invoke(2);
>
> Cheers,
> Neal
Cheers,
Rémi
>
> On Sun, Dec 27, 2009 at 8:31 AM, Rémi Forax <forax at univ-mlv.fr
> <mailto:forax at univ-mlv.fr>> wrote:
>
> I've sketch a prototype of lambdas on top of method handle.
> http://weblogs.java.net/blog/forax/archive/2009/12/27/chistmas-gift
>
> The patches are here:
> http://cr.openjdk.java.net/~forax/lambda/
> <http://cr.openjdk.java.net/%7Eforax/lambda/>
>
> Rémi
>
>
More information about the lambda-dev
mailing list