by charriu · 11y ago · 0 comments
For example, scoping: For backwards compatibility reasons, var has to stay function scoped. But now we also have let, which has different scoping rules. Also, Symbols: [Symbol.iterator]() - what? Why?!
On the other hand, stuff like arrow functions, template strings, modules and tail optimization are awesome.
For example, the scoping rules: why have two separate scoping rules for let and var? To put it another way, would ES6 have let and var with differing scoping rules if it was designed today? If not, then it's a flaw (any difference from what a clean redesign would look like I consider a flaw).
Why not just make a simple and consistent syntax?
Not breaking millions of websites.
Maybe even orders of magnitude more than that.
So your fundamental choices are really an ES6 that is backwards-compatible or an ES6 that is not used.
Welcome to C++.