Reified Lambda Functions
Maurizio.Cimadamore at Sun.COM
Thu Jan 7 04:11:04 PST 2010
Howard Lovatt wrote:
> I have posted a *more* formal proposal for reifying lambdas (as suggested by
> Neal Gafter):
> This could be read in conjunction with the original informal proposal:
> Which is an easier read :)
> -- Howard.
> 2010/1/3 Neal Gafter <neal at gafter.com>
Wouldn't be more elegant to re-use one of the many existing approach to
tackle reification and then restrict it so that only function types are
The classloader solution you are proposing is very similar to the
solution proposed by the author of NextGen (a reified Java compiler)
- there are some disadvantages with that approach:
1) Creates one classfile per generic instantiation - since you are using
a modified classloader you can probably avoid generating a classfile and
synthesize it on the fly - nevertheless the solution will result in
increased static footprint.
2) Heterogeneous (one class per instantiation, as in C++) approaches for
handling reification have proven to be relatively weak when it comes to
deal with generic methods - this might not be a problem since your goal
is to reify lambdas only which corresponds to classes.
A bunch of additional problems that I see in your approach:
- your proposal does not fully reify lamdas; #(x:List<Integer>) and
#(x:List<String>) will still be identical types
- you need to take into account type-variables; #(x:T) - reification in
this case is much more complex as the concrete type of T will depend on
the generic instantiation of the context in which the lambda is defined.
 - http://www.cs.rice.edu/~javaplt/nextgen/
>> On Sun, Jan 3, 2010 at 3:04 PM, Howard Lovatt <howard.lovatt at iee.org>wrote:
>>> I have updated the post to cover your example; thanks it is another
>>> difficult case that needs to be addressed. The updated blog is at
>>> I have included a list example like the one you gave. For comparing
>>> you need to use equals not ==.
>>> Keep the difficult cases coming there may be more subtile bugs in the
>>> proposal that these examples will tease out.
>> It isn't clear how to generalize your particular examples into rules for
>> handling all examples. While the examples are helpful, they don't really
>> provide much confidence in the concepts without those underlying rules. Can
>> you please try to formulate your proposal into a set of more generic rules
>> for handling all cases? Trying to formalize the rules would also help us
>> (and you) to understand if and where rules might be missing.
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email
More information about the lambda-dev