The ES6 compatibility table is very useful, as it tells us the ES6 features that are supported in the current browser. It also gives us a handy link to the specifications for each of the features listed. You will find that the current versions of browsers are implementing these features as fast as they can. The table shows that some subset of the feature exists, so as we say, “your mileage may vary”. That said, it is coming.
I don’t have any particular insider information, but wanted to share what I am learning as I explore ECMAScript 6 and what it means to the way that code is written today. In my search I found two great articles that I am pulling information from:
My value add is to provide context for the previous posts and show how your code in the future could look like to implement many of the same features. And this topic is fluid so again, “your mileage may vary”. My intent is to give you can idea of what is coming and how soon to help you decide how deeply you want to invest in the current technologies. That said, one of the goals in ECMAScript 6 is to not break anything you are doing now.
- For complex applications
- For libraries (including the DOM)
- As a target for code generators
The design is by a couple experts with feedback from TC39 and the web community. There’s lots of field testing and browser, compiler manufacturers are on board building features and developers are trying them out. You too can get started.
Actual versions of draft you can find here: http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts.
The ES specification for 6 is planned to be finalized, I think, June 2015. ES 7 currently has no date of arrival.
The feature set has been forzen. Features are appearing in the newer versions of browsers, including Internet Explorer, Chrome, and Firefox. There isn’t a lot of buzz around them because they are very much work in progress.
The specification should be finished any day now.
Publication process is scheduled for March 2015.
Formal publication in June 2015.
Of course there are challenges with compatibility. The new version must run all existing code, which means that ECMAScript 6 includes only new features.
Major New Features
- let (global scope)
- let (local scope)
- Destructuring assignment
- for…of statement
- Iterators and generators
- Default parameters
- Spread operator of Array
- Arrow functions
- Array comprehensions
- Better support for Unicode (strings and regular expressions)
- Optimizing tail calls
Will explore in the next post.
What’s Happening with Modules?
ES6 Module Loader Polyfill that is based on ES6 for Node.js and for browsers with some
Shims for ES6 Promises. Q.Promise is compatible with ES6.
There are several overlaps and complimentary features between TypeScript and ECMAScript 6. The team is aligning TypeScript with ECMAScript. You can follow the progress on CodePlex here: http://typescript.codeplex.com/wikipage?title=ECMAScript%206%20Status
Angular 2.0 has taken a dependency on ECMAScript 6. All code in AngularJS 2 is already being written in ES6. As ES6 doesn’t run in browsers today, the Angular teams is using the Traceur compiler to generate the nice ES5 that runs everywhere. They are also working with the Traceur team to build support for a few extensions like annotations and assertions. The team calls their superset of extensions “ES6 +A”.
Though AngularJS will be in ES6, you can still write in ES5 if you don’t want to upgrade. The compiler generates readable JS and there are human-sensible analogs for the extensions.