Allen Wirfs-Brock (2014-01-30T16:05:14.000Z)
domenic at domenicdenicola.com (2014-02-04T21:32:35.449Z)
On Jan 30, 2014, at 7:43 AM, John Lenz wrote: > 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? > The anomaly is that `var` was considered a statement in ES1. But note that the only other declaration in the language (`function`) at that time was not a statement. See http://www.wirfs-brock.com/allen/draft-ES5.1/#sec-14 Declarations have global static impact within their containing scope (function or block). It generally doesn't make any sense to use them in a conditional context without an explicitly surrounding block that constrains their scope. So all new declarative forms in ES6 are treated similarly to function. They are declarations but not statements. `var` must remain a statement for legacy compatability.