EcmaScript 6 is in the final stages of being standardized. The last few parts are being added to the spec, by March 2014 it will be finalized, and the rest of the year will be spent on formatting and layout. By this time next year, ES6 will be an official standard of the Ecma organization!
But how soon after this can we start using ES6? How quickly will all the browser vendors adopt the new spec and implement all the new features into the latest version of the major browsers? And how long until the old browsers without ES6 support lose enough market share that we don't need to worry about them?
But other parts of ES5 are used, even if they aren't supported by IE8. This possible through polyfills and shims, which add missing APIs to to the runtime. So while IE8 does not implement the array functions
forEach, they can be made available by adding a small script to the start of the page.
That's right, you can have your CoffeeScript modules be compiled in the browser by the end user! The module loader has a method,
Loader.prototype.translate, which is called every time a module is loaded. It is given the contents of the module as a string so it can translate it however it wants. With a sufficiently advanced translate method you can
import a C++ module and have it be compiled to asm.js. Or you could
import an ES6 module and translate it to ES5.
There are already many transpilers/compilers which can convert a subset of ES6 to ES5. One example is Regenerator which can (only) convert ES6 generators into ES5 code. Imagine a browser which implements nothing but modules from the ES6 spec. By setting the
Loader.prototype.translate method to run Regenerator, a module could use generators and still work in this browser.
The Traceur compiler can compile many of the new features in ES6 into ES5. By using this in the
As long as a browser implements modules, any other feature of ES6 can be used in the browser. Just like shims and polyfills have helped us use ES5 features in browsers without ES5 support, modules will let us use ES6 features in browsers without full ES6 support. And when ES7 is standardized in a few years, it too can be used in browsers without ES7 support.
This means that browser vendors should focus on implementing modules before any of the other feature of ES6. The moment all browsers in use support modules is the moment all features in ES6 can be used, thanks to the
Loader.prototype.translate method. We can reach this point quicker if browser vendors prioritize modules above other ES6 features.