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 11:02:36 PDT 2010


My bad,
I misread your example - what you are trying to do it's ok (except from 
the fact that you are using function types, that are not supported in 
the current draft ;-) ). Your program is rejected because of a straight 
bug in the prototype. I will be fixing this shortly.

Thanks for the headsup
Maurizio

On 26/07/10 18:27, Maurizio Cimadamore wrote:
> 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