Optional brackets around lambda expression (was: Expecteddistribution of lambda sizes)
John Nilsson
john at milsson.nu
Fri Jun 17 07:49:07 PDT 2011
To meet is is just one of those things you learn once and then it
isn't ambiguous any more.
It's a simple enough rule: The body of an abstraction extends as far
right as possible. (Just borrowing verbatim from
http://en.wikipedia.org/wiki/Lambda_calculus )
BR,
John
On Fri, Jun 17, 2011 at 1:11 PM, <david.moss at ubs.com> wrote:
> Seems to me this is ambiguous; you could have the following situation,
> for instance:
>
> String b = "some";
> Comparable<String> comparator = #(a, b) a.length() - b.length();
>
> And not know whether it should be read as:
>
> String b = "some";
> Comparable<String> comparator = (#(a, b) a.length()) - b.length();
>
> Or:
>
> String b = "some";
> Comparable<String> comparator = (#(a, b) a.length() - b.length());
More information about the lambda-dev
mailing list