Project Lambda: Java Language Specification draft

Stefan Schulz schulz at the-loom.de
Sat Jan 23 16:20:30 PST 2010


24.01.2010 00:30, Neal Gafter:
> I like the dot version, and it need not be specific to closures.  That
> is, define the syntax
>
> primary . ( expressions )
>
> for SAM types to have the same meaning as
>
> primary . invoke ( expressions )
>
> where "invoke" is the name of the SAM's abstract method.  For example
>
> Runnable r = ...;
> r.(); // calls r.run()

To me, the dot-only version is hard to spot and distinct from a method 
invocation and may easily become a source of bugs, e.g., having a method 
and a lambda with the same name in the same scope. While a method-like 
invocation for lambdas would treat such cases, a dot-only invocation 
does not.

-Stefan


More information about the lambda-dev mailing list