Optional brackets around lambda expression

Roel Spilker r.spilker at gmail.com
Fri Jun 17 03:10:07 PDT 2011


>
> >>
> >> IDENTIFIER '->' ...
> >>
> >> In all other cases you need enclosing parens, as in:
> >>
> >> (a,b,c) ->  body
> >> (Type1 a, Type2 b)->  body
> >>
> >> [the above can be disambiguated from a cast or a parenthesized
> >> expression because of the trailing ')->' sequence, which would be unique
> >> to lambdas].
> >>
>

IIRC, the current parser treats '-' and '>' as separate tokens, so you would
probably still need to increase the lookahead.

INDENTIFIER MINUS GREATER_THAN

instead of

IDENTIFIER RIGHT_ARROW


More information about the lambda-dev mailing list