hg: lambda/lambda/langtools: Next round of implementation reflecting the latest 'State of the Lambda' draft; implemented features are:

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Jul 26 10:27:52 PDT 2010


On 26/07/10 17:10, Peter Levart wrote:
> public class Closures
> {
>    public static #int() twice(final int value)
>    {
>      return #{ value + value };
>    }
>
>    public static #int() twice(final #int() func)
>    {
>      return #{ func.() + func.() };
>    }
>
>    public static void main(String[] args)
>    {
>      System.out.println(twice(22).());
>
>      #int() fortyFour = twice(#{22});
>      System.out.println(fortyFour.());
>
>      //System.out.println(twice(#{22}).());
>    }
> }
>    
Thanks for the report,
I was partially aware of the issue. The fact is that the current 
prototype does not support the lambda invocation syntax anymore (that 
is, we removed '.()'). As a result, lambda expression should only appear 
'bare' in a method call/assignment context.

I think that, however, the compiler should at least generate a better 
error message in this case; I managed to handle most cases, but not all yet.

Thanks
Maurizio


More information about the lambda-dev mailing list