Lambda Conversion Considered Harmful?
Joshua Bloch
jjb at google.com
Fri Feb 19 11:52:17 PST 2010
Neal,
On Fri, Feb 19, 2010 at 11:22 AM, Neal Gafter <neal at gafter.com> 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.
>
> > 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.
>
As per my previous e-mail, I'm worried about the semantics of lambda
conversions (both project lambda's and BGGA's) as well as the performance. I
consider the lack of an accurate "this" to be a serious issue, as well as
the inability to work on class types and access class members. Also it's
confusing to have a widening reference conversion from one interface type to
another when the latter ("wider") interface doesn't include a method present
on the former (invoke).
Josh
More information about the lambda-dev
mailing list