Syntax decision

Brian Goetz brian.goetz at oracle.com
Sat Oct 1 14:31:24 PDT 2011


>> Personally, I find the selected syntax OK, but not great, except in
>> the x ->  expr form. Thats because I dislike the way that the argument
>> brackets blend into the method parameter brackets when passing to a
>> method as in sort((a,b) ->  a - b). I always find its the blending of
>> similar characters that is hardest to read, and why # was useful
>> punctuation. Thats also why I might well prefer a Ruby-like sort(|a,b|
>> a - b), because the characters do not blend in the same way.
>
> This is where I'm at. Lambdas may be delayed execution or executed on
> another or many threads, they _shouldn't_ blend into their
> surroundings in the manner of other sequentially executed code.

The feeling in the expert group was that this is something that is going 
to change over time.  It is tempting to make lambdas look really 
different because delayed evaluation is new NOW, but it doesn't take 
long before that difference looks like a hammer over the head.  In this 
case, the hammer was the kind with a waffle pattern on its head, shaped 
like #.

The reality is: there's no perfect syntax; if there was, we'd surely 
have found it.  What looks beautiful to one person is too subtle to 
another.  We picked something that we thought was good, and which has 
been shown to work in other Java-like languages.



More information about the lambda-dev mailing list