In my model

if (y) let x = 42

is equivalent to

if (y) {
  let x = 42
}

and it is clear "x" in "alert(x)" is 0;


On Thu, Jan 30, 2014 at 7:54 AM, Brendan Eich <bren...@mozilla.com> wrote:

> John Lenz wrote:
>
>> Generally, I've always thought of:
>>
>> "if (x) ..." as equivalent to "if (x) { ... }"
>>
>
> let and const (and class) are block-scoped. {...} in your "if (x) {...}"
> is a block. An unbraced consequent is not a block, and you can't have a
> "conditional let binding".
>
> The restriction avoids nonsense such as
>
> let x = 0; { if (y) let x = 42; alert(x); }
>
> What pray tell is going on here, in your model?
>
> /be
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to