Hacker News new | ask | show | jobs
by octatone2 4117 days ago
I think it's important for the VM, which is what I got as to why they are proposing strong mode and sound types.

I imagine that let and const afford optimizations to the VM.

1 comments

The flag offers optimizations -- except they don't exist unless you compile a version of ES6 code for chrome only.

Sure other ES6 browsers will ignore the string and move on, but they will have other ES6 compatibility issues. For example, Chrome's "fat arrow" doesn't do the lexical bind to the parent scope that the current spec requires. There are a ton of situations where this would break your code if you ran it on FF (and there are other differences).

The only option is to transpile into ES5.1, but ES5.1 breaks the optimization requirements.

Thus, using the optimization flag means building to Google's JS engine (we've been there with IE), while building a shared version means you cannot use the flag.

Let adds scopes. Scopes are bad for performance (this is why closure compiler removes them). Removing them (if safe) is one more thing for the JIT to do. It's has little to do with efficiency and a lot to do with forcing another language's preferences on users.

> For example, Chrome's "fat arrow" doesn't do the lexical bind to the parent scope that the current spec requires.

And that's why fat arrows are currently not enabled in Chrome. Chrome exposes in development features behind flags. IMO vastly better than the vendor prefixes of ages past.