Lambda Conversion Considered Harmful?

Joshua Bloch jjb at google.com
Fri Feb 19 15:36:36 PST 2010


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

> 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.


Just to echo Alex's concerns, I was fooled by this, hence my statement that
it was converting from one interface to another. JLS 3 (Section
5.1.5)<http://java.sun.com/docs/books/jls/third_edition/html/conversions.html>says
"
A *widening reference* conversion exists from any type *S* to any type *T*,
provided *S* is a subtype
(§4.10)<http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#120403>
 of *T*."  The lambda conversion described in CfJ does not meet this
specification, so it's wrong to call it a widening reference conversion.

          Josh


More information about the lambda-dev mailing list