Lambda Conversion Considered Harmful?
Alex Buckley
Alex.Buckley at Sun.COM
Fri Feb 19 14:09:35 PST 2010
Neal Gafter wrote:
> On Fri, Feb 19, 2010 at 11:18 AM, Joshua Bloch <jjb at google.com> wrote:
>> I don't think so. The BGGA proposal also uses the lambda conversion to
>> produce SAM-type (interface only) implementations.
>
> Not so. What BGGA calls the lambda conversion is completely unrelated
> to what project lambda calls the lambda conversion. I don't know why
> project lambda uses that name, by the way, since it converts a
> function type to a SAM type; lambdas have nothing to do with it.
A conversion in the Java language is a mapping from one type to another
type. BGGA/CfJ describes a mapping from an expression to a type, so I
don't know why you call it a conversion.
>> I believe the lambda
>> conversion is just getting in our way. I really do think we should explore
>> a design where we have two distinct syntaxes: one for "structural function
>> objects" (lambdas in the current proposal) and one for "nominal function
>> objects" (SAM-type instances).
>
> BGGA demonstrates that you can do both with one syntax, and without
> the performance hit of the current draft's lambda conversion.
It is irregular to support "conversion" from only a literal lambda
expression to a SAM type, rather than from any value of function typre
to a SAM type.
Alex
More information about the lambda-dev
mailing list