Method calls vs lambda calls
Rémi Forax
forax at univ-mlv.fr
Tue Dec 15 06:29:40 PST 2009
Mark Thornton a écrit :
> 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
>
>
>
And this will not compile :(
public class Example {
#int() fourtyTwo = #() {return 42; };
{
f(fourtyTwo);
}
public void f(#int v) {
...
}
}
Rémi
More information about the lambda-dev
mailing list