On Jun 30, 2011, at 6:32 PM, Mike Samuel wrote:
> 2011/6/28 Brendan Eich <[email protected]>:
>> On Jun 23, 2011, at 3:27 PM, Brendan Eich wrote:
>> Block:
>> { UnlabeledStatementFirstList }
>> { WellLabeledStatement StatementList? }
>
> If IfStatement is still defined
>
> IfStatement :
> if ( Expression ) Statement else Statement
> if ( Expression ) Statement
>
> then does this definition of Statement and Block change the program
>
> if (foo) { bar(); } else {}
>
> to be equivalent to
>
> if (foo) { bar(); } else ({})
>
> ?
No, remember I wrote "We'd still need the [lookahead ∉ {{, function}]
restriction in ExpressionStatement."
> This is arguably a semantic change, but the change cannot be
> detectable by anything else the program could do.
That's not true if the {} in statement context were an expression whose result
was discarded. In such an event (without the lookahead restriction and with
some other restriction to disambiguate away from block-as-statement to
block-as-expression), the completion value would differ from in ECMA-262 as it
is, and eval or an embedding (javascript: URLs, e.g.) could tell.
But that empty block else clause is not a block-as-expression: it's a
block-as-statement, so same semantics as in ECMA-262 as-is.
/be_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss