John Lenz (2014-01-30T15:43:24.000Z)
It seems unfortunate that "let" and "const" have different usage rules from
"var".  It seem strange  that "var" is considered a statement and not
declaration as per:

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-statements-and-declarations

Generally, I've always thought of:

"if (x) ..." as equivalent to "if (x) { ... }"

Does this restriction on let/const enable anything?





On Wed, Jan 29, 2014 at 10:31 PM, Erik Arvidsson
<erik.arvidsson at gmail.com>wrote:

> It falls out of the grammar.
>
> IfStatement can only contain Statement which does not include Declaration
> without going through a BlockStatement.
>
>
> On Wed, Jan 29, 2014 at 9:57 PM, John Lenz <concavelenz at gmail.com> wrote:
>
>>  I have some old notes that says that "let" can't be used in some
>> context where a var could like:
>>
>>   if (a) let x = 2;
>>
>> In my perusal of the spec I don't see that this is the case now.  Can
>> someone confirm that for me?
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
>
> --
> erik
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140130/84c805ef/attachment.html>
domenic at domenicdenicola.com (2014-02-04T21:23:59.454Z)
It seems unfortunate that `let` and `const` have different usage rules from
`var`.  It seem strange  that `var` is considered a statement and not
declaration as per:

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-statements-and-declarations

Generally, I've always thought of:

`if (x) ...` as equivalent to `if (x) { ... }`

Does this restriction on `let`/`const` enable anything?