Project Lambda: Java Language Specification draft

Osvaldo Pinali Doederlein opinali at gmail.com
Sat Jan 23 10:43:00 PST 2010


Em 23/01/2010 14:43, Stephen Colebourne escreveu:
> I find the ! invocation pretty darn ugly I'm afraid. I can't help
> reading "not". The symbol also blends into the brackets visually.
>
>   assert doubler.invoke(fortyTwo.invoke()) == 84;
>
> The simple approach is more verbose and explanatory, which is quite in
> the style of Java

I didn't like '!' either, but I don't like .invoke any better - and the 
argument that "the style of Java is verbose" is locally much less valid 
in the context of this proposal; lambdas can be roughly explained to 
most Java programmers as "less verbose inner classes", and it's really 
just that - sugar - especially if we don't include the most 
sophisticated bits like control abstractions, currying, etc. So, it's 
arguably incoherent to fight for adding verbosity back for particular 
problems - I remember proposals to have a keyword 'lambda' instead of 
'#', etc. We can always fall back to inner classes with all their 
glorious, extensive syntax...

We've already been though this entire debate, my preference was for 
transparent lambda invocations - just doubler(fortyTwo()) - but this 
option raised so many issues that we should better forget about that, if 
we want a spec in time for Java7. Having said that, I hope we can at 
least put some effort to pick nice options whenever explicit syntax is 
required. In lambda calls, my vote goes for ANY operator instead of 
invoke() or similar methods. John suggested the dot, as in 
doubler.(fortyTwo.()). It makes a lot of sense (although a bit weird), 
looks like a good solution.

A+
Osvaldo


More information about the lambda-dev mailing list