On Jan 12, 2012, at 3:41 PM, Jon Zeppieri wrote:
>>
>
> An additional consideration: for a block lambda's completion value to
> be another block lambda, the {( syntax would require parenthesis,
> while the {| syntax would not:
No, since a Statement can not begin with a { character parenthesis would be
required in using either syntax. Also note that they would also be required if
completion value of the BlockLambda is provided by an object literal:
{| a,b | ({x: a,y: b})} //syntax error if parenthesis around object
literal are removed
> ...
>
> With the grammar François is suggesting, this would be a syntax error
> (I think), since the body of a block lambda is a StatementList_opt.
> The {| syntax, on the other hand, can accommodate block lambdas as
> expression statements, though, given another token of lookahead
> (again, I think).
With two token look-ahead a | BlockLambda could be allowed at the head of a
statement, but it still would not enable unparenthesized object literals at the
head of a statement. It seems like a cognitive burden to allow one but not
the other. A simple "{ at the start of an expression statement must be
parenthesized" rules seems easiest to learn and remember.
Allen
>
>>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss