Allen's lambda syntax proposal
David-Sarah Hopwood
david.hopwood at industrial-designers.co.uk
Thu Dec 4 12:11:31 PST 2008
Yuh-Ruey Chen wrote:
> Eric Suen wrote:
>> In feature(ES4), ES may have OptionalParameter, that will cause trouble
>>
>> { |a ,b = 1 | c | d | e | f }
>>
>> is
>>
>> { (|a ,b = 1 |) c | d | e | f }
>>
>> or
>>
>> { (|a ,b = 1 | c) | d | e | f }
>>
>> Regards,
>>
>> Eric Suen
>>
>
> That should be a syntax error. Parenthesis should be required in that
> case to avoid ambiguity: {|a, b = (1 | c)| ... }
Yuck. The restrictions on 'in' are bad enough; this is essentially the
same kind of ambiguity in another context. Requiring expressions
containing '|' to be parenthesized would impose the same degree of
grammar complexity overhead again as that imposed by 'NoIn':
ArgumentInitialiser :
= ExpressionNoBar
= ( Expression )
... unless all default argument initialisers have to be parenthesized,
but that is just ugly.
--
David-Sarah Hopwood
More information about the Es-discuss
mailing list