Method calls vs lambda calls

Mark Thornton mthornton at optrak.co.uk
Tue Dec 15 06:21:57 PST 2009


Mark Thornton wrote:
>>   
>>     
> A simple solution would be to specify that method valued fields are in 
> the method namespace. Your example would then not compile. I think this 
> would be preferable to having different syntax to discriminate between 
> the method call and invoking a field.
>
> Mark Thornton
>
>
>   
I realise that this then allows

public class Example { 
   private int fourtyTwo = 42;
   public #int() fourtyTwo = #int() {return fourtyTwo;}

   public void run() {
      System.out.println(fourtyTwo());
   }
}

I think I would accept that as the price for the more convenient 
invocation syntax.

Mark Thornton



More information about the lambda-dev mailing list