revive let blocks

Kyle Simpson getify at
Thu Jun 18 13:01:53 UTC 2015

> Be aware that the way you utilize 'let' will be a breaking change. In ES5 and ES6

In addition to the fact that this feature is long since co-existing in FF and doesn't seem to have broken the web, IIUC, there was already a "breaking change" in ES6, with `let` and destructuring:

let[x] = foo();

I believe it was deemed that the chances of that breakage being widespread were low enough to warrant the `let` feature anyway. I would postulate (though I don't have the facility to test it) that the exact function-call-and-block pattern `let(x) { .. }` would be as much or less likely to occur in legacy code than `let[x] = foo()`.

> If you consider use of block without context is ugly, use if(true) or do-while(false)

Those options are much uglier than the standalone `{ .. }` block.

More information about the es-discuss mailing list