On Thu, Jan 30, 2014 at 7:54 AM, Brendan Eich <brendan at 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?
I'm with John: the alert should say 0 and I can't see why that is not
obvious.
>
>
> /be
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140130/e454c01b/attachment-0001.html>
domenic at domenicdenicola.com (2014-02-04T21:24:34.661Z)
I'm with John: the alert should say 0 and I can't see why that is not
obvious.
On Thu, Jan 30, 2014 at 7:54 AM, Brendan Eich <brendan at 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? I'm with John: the alert should say 0 and I can't see why that is not obvious. > > > /be > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140130/e454c01b/attachment-0001.html>