2011/6/30 Brendan Eich <[email protected]>:
> On Jun 30, 2011, at 6:32 PM, Mike Samuel wrote:
>
> 2011/6/28 Brendan Eich <[email protected]>:
> No, remember I wrote "We'd still need the [lookahead ∉
> {{, function}] restriction in ExpressionStatement."

Ok, then by this redefinition of Block,
    if (foo()) {}
is not a valid program because it is not possible for a Block to not
contain any statements.  Neither UnlabeledStatementFirstList nor
WellLabeledStatement match the empty string.

> 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.

Ah, I completely forgot the completion value.
Yes.
    typeof eval("if (true) {}") === "object"
would distinguish.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to