Method calls vs lambda calls

Mark Thornton mthornton at optrak.co.uk
Tue Dec 15 06:07:47 PST 2009


Alex Blewitt wrote:
> This was, of course, a leading question. Now consider:
>
>   
>
>   
>>>>>> public class Example { #int()       public fortyTwo = #int()  
>>>>>> { return 42; }
>>>>>>   public int fortyTwo() {
>>>>>>     return 6*9;
>>>>>>   }
>>>>>>   public void run() {
>>>>>>     System.out.println(fortyTwo())
>>>>>>   }
>>>>>> }
>>>>>>             
>
>
> Sent from my (new) iPhone
>
>   
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



More information about the lambda-dev mailing list