August 14, 2015. Mark your calendars. That’s my next birthday. Another important date is June 18, 2015–it’s when the ECMA General Assembly will vote on and approve the 6th edition of Ecma-262 and usher in the next era of JavaScript. On that day, all those new language features we’ve been coveting/dreading will officially enter our lingua franca. Today, Bocoup is starting on an exciting collaboration with Google and TC39 to prepare for the big day. Before we get into that, though, we should talk about what needs to be done in general.
As JavaScript users, the best thing we can do to prepare is to study the specification and continue experimenting with new features as they become available. We’ll start forming opinions about various patterns’ readability and potential for mistakes, and we’ll update our style guides accordingly. (Can we start by outlawing IIFEs inside default parameter definitions?) Honestly though, it’s going to be a quiet day for us. But for language implementors, this is just the beginning of the work.
The completed ECMAScript 6 specification will make for a daunting “to-do” list
for implementors, but the promise of June 18 (besides the Promise
itself)
is stability. Any ambiguities one might expect from a working draft will be
resolved (we hope!), so implementors can assess the correctness of their work
objectively. And because the spec will not change from that day onward,
compliance will no longer be a moving target.
We all make mistakes, though, and even a rock-solid specification can’t change that. The safest way forward (as always) is through automated testing. TC39 recognizes this by maintaining an official test suite for the JavaScript language: Test262. Where the specification serves as an instruction manual, Test262 offers an automated mechanism for verification.
The “draft” state of the new specification poses the same challenges to Test262 as it does to language implementors. That means that today, the test suite lacks coverage for many of the proposed (and potentially unstable) features. If Test262 is left in this state, implementors will have little to fall back on when they begin overhauling their JavaScript engines later this year.
This is where Bocoup and Google come in.
We’re collaborating with the V8 team to improve Test262’s coverage of all the new functionality. The V8 project already has a good number of sweet, sweet ES6 tests (see here and here). To jump-start the process, we’re working to port those tests to the Test262 harness. After that, we’ll focus on writing brand new tests. We’re prioritizing the parts of the specification that are least likely to change and most likely to trip up implementors (i.e. classes, iterators, lexical scoping, etc.), but our goal is to cover as much as the specification as possible. We’ll apply our own experience learning the ropes of Test262 to improve the experience for others. This means updating the documentation when necessary and keeping an eye out for ways to optimize the development workflow.
So what can you do? For starters, you can watch this space for more info on contributing tests. If you’re feeling ambitious, consider getting your hands dirty and implement a feature or two in your favorite engine! Finally, we can’t forget that no matter how well-designed or well-tested, these features will be useless if they aren’t deployed. So please: continue encouraging adoption of the most progressive, open platforms within your company and among your friends!