Optional brackets around lambda expression
int19h at gmail.com
Fri Jun 17 11:15:57 PDT 2011
My impression certainly was that parens are only required for 1-arg cases.
At least all examples in the post which introduced the "no-parens-at-all"
syntax were unary lambdas.
On Fri, Jun 17, 2011 at 8:26 AM, Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:
> On 17/06/11 15:48, Bob Foster wrote:
> > Maurizio Cimadamore wrote:
> > >
> > > Of course you can lookahead; but certain expressions, as pointed out
> > > will remain ambiguous:
> > >
> > > process(x, y, z, a, b, c, d -> a);
> > Assuming parenthesis are required for multiple arguments and optional
> > for single arguments, the example has only one parse, equivalent to:
> > process(x, y, z, a, b, c, (d) -> a);
> I think we were discussing a proposed variant were parenthesis were
> optional all around (regardless of arity). If parenthesis are required
> only for arity > 1, then I agree with your analysis.
> > Bob
More information about the lambda-dev