Syntax decision
Steven Simpson
ss at comp.lancs.ac.uk
Wed Sep 28 08:04:07 PDT 2011
On 28/09/11 15:41, Brian Goetz wrote:
> The nilary syntax is still a thorn. But the obvious solution outlined
> below -- allow elision of the () -- leads to a syntactic ambiguity. If
> -> { statement; } were a valid lambda, then is:
>
> (identifier) -> { statement; }
>
> a one-arg lambda with inferred type, or a cast of a nilary lambda?
What happens if you treat it as an inferred-type unary? If the author
intended a casted nilary, will he always get compilation failure?[1] If
so, can he fix his error by adding the empty param list?:
(identifier) () -> { statement; }
IOW, nilary brackets aren't always optional.
[1] Hmm, does he get a syntax error or something more obscure?
More information about the lambda-dev
mailing list