Translation Using asSam() and LINQ for Java

Ming-Yee Iu mingyeeiu+lambda at gmail.com
Fri May 28 12:26:06 PDT 2010


I'm concerned that translating lambda expressions to bytecode using
MethodHandles and asSam() will make it difficult if not impossible to
create some sort of LINQ-equivalent for Java.

If lambda expressions are compiled down to inner-classes, then someone
could add LINQ functionality to JDK7 using a clever classloader (as
long as there is automatic closure conversion to interfaces or support
for annotations on lambda expressions). When using MethodHandles and
asSam(), my gut feeling is that it is not possible to implement
something like LINQ without having a special compiler for a
LINQ-supporting-variant of Java.

Perhaps JDK7 could use only inner classes for its anonymous functions,
and this asSam() stuff could be delayed until JDK8 when people have
more experience with what they want to do with lambda expressions.

-Ming


More information about the lambda-dev mailing list