For anyone interested in trying some of this stuff out (which I highly recommend, because a lot of the new stuff in ES6 is really great), Google has an awesome tool called Traceur [<a href="https://github.com/google/traceur-compiler" rel="nofollow">https://github.com/google/traceur-compiler</a>] that will compile ES6 into ES5.<p>There's also an online version here: [<a href="https://github.com/google/traceur-compiler" rel="nofollow">https://github.com/google/traceur-compiler</a>] that's great for quick little experiments. And, as an added bonus, it encodes your script in the URL so you can share it.
This, and the short function syntax (that's also already in Firefox stable: "let square = x => x * x") make me very giddy. It's always been possible to write JavaScript in a functional style - but this kind of sugar makes it much much nicer. Things like Traceur will even let us transpile to old-school JS for old browser support, so for a lot of projects we can start using these things real soon.
For anyone wondering, TypeScript will also include support for this <a href="http://typescript.codeplex.com/workitem/15" rel="nofollow">http://typescript.codeplex.com/workitem/15</a>
This is great and allows us to do some slicker functional code:<p><pre><code> function take(num, list) {
if (num <= 0 || !list || list === []) return [];
var [head, ...tail] = list;
return [head].concat(take(num - 1, tail));
}
</code></pre>
It's not as elegant as haskell but it's still nicer than it would be without the new syntax.<p>Once we have support for tail call optimization, things will get really interesting.
Yet another great feature heavily inspired from CoffeeScript (and tastefully expanded upon). Well done!<p>The surprising thing for me is that destructuring _almost_ allows defining default values for function arguments.
Definitely looking forward to this as well as other new ES6 stuff. There's something else I feel I could use perhaps even more but I haven't seen it in any of the ES* updates. I'm a huge advocate of DRY and it bothers me when I have to code something like:<p><pre><code> var a = objImUsing.prop.someLongName > 5 ? objImUsing.prop.someLongName : whatever;
</code></pre>
I can and sometimes just make an extra variable above for a long prop list like this but that adds an extra line. I guess what I would like would be some sort of implied line limited scope:<p><pre><code> var a = objImUsing.prop.someLongName > 5 ? _1 : whatever;
</code></pre>
_1 referring to the first mentioned value in the immediate parent statement.
I can see why Brendan Eich is excited to get ES6 out there. It's finally coming back around to parity with Scheme. I'm looking forward to seeing more.
PHP has this available as list[1] in a slightly more limited form.<p>1. <a href="http://php.net/list" rel="nofollow">http://php.net/list</a>
That's awesome.<p>Any bets on when we can start using it on the front-end? I'm sure Chrome/FF will pick it up quick once it's finalized, but when will ECMAScript 6 be present in 95% of IE installations? 2020?