Lambda Conversion Considered Harmful?

Neal Gafter neal at gafter.com
Fri Feb 19 15:49:56 PST 2010


On Fri, Feb 19, 2010 at 3:34 PM, Alex Buckley <Alex.Buckley at sun.com> wrote:

> Neal Gafter wrote:
>
>> The type of a lambda expression in CfJ is not denotable in source, but
>> that isn't the same as saying that it doesn't have a type.  The type of a
>> lambda expression in CfJ is defined by the set of declared argument types,
>> result expressions, and thrown types of the lambda's body.  The lambda
>> conversion is a binary relation all of whose pairs are the type of a lambda
>> expression on the left and a SAM interface on the right.
>>
>
> While CfJ already avoids saying that the type of a lambda expression is a
> function type, it would be nice if the paragraph above was incorporated into
> the CfJ specification.


Done.


> OK. And just so everyone is clear: the Lambda spec does not mandate that a
> function type is a SAM type. If you were implementing BGGA today, would you
> look at using MethodHandles?


Absolutely.  And then the lambda conversion would be defined from lambda
expressions to SAM interfaces *and* from lambda expressions to function
types.  But likely not from function types to SAM interfaces (though the
programmer could use a method reference to do that, or a separate conversion
could be defined).


More information about the lambda-dev mailing list