Free email newsletter: “ES.next News

2015-02-17

A 90 minute overview of ECMAScript 6 (video)

On February 1, 2015, I held the 90 minute talk “Using ECMAScript 6 today” at the Rolling Scopes Conference in Minsk. A video recording of that talk is online:

6 comments:

Axel Rauschmayer said...

Great intro to ES6 features. The problem that still remains though is tooling. I find it pretty hard to decide on what to use, even though there are not many. I tried 6to5 and got pretty good results but Traceur is maintained by Google which makes the way to go hard to choose. I would be happy to hear some opinions on this.
Great talk Alex!

Axel Rauschmayer said...

Hi,

Yeah, I tried to delete my comment. I got it wrong :-)

Btw, checked out Babel and its sub classing? Awesome stuff :-)

https://babeljs.io/docs/learn-es6/#subclassable-built-ins

Axel Rauschmayer said...

Great talk, thanks! Regarding the object literal, computed property and symbol.


// version 1
var obj = {
[Symbol.iterator]() {
...
}
}
for (let x of obj) { ... }


// version 2
var obj = { ... };
for (let x in obj) {
if (obj.hasOwnProperty(x)) { ... }
}


Are those two code snippets equivalent? Are there any advantages and disadvantages between them? Are there any preferable use cases?

Axel Rauschmayer said...

Superb! I learned a *lot*, subtleties I hadn't caught.


I've got a concern that you mentioned: optimizing GC for all the places arrays/objects are core to es6.
- Generators returning objects: {value: 0, done: false}
- destructuring via arrays & objects (let [x,y] = [y,x]),
- multiple return values,
- rest parameters,
- named parameters,
- spread operator,
- for-of loops like your ex: for (let [key, value] of map) {...{


.. and more. Some seem to be syntactic, and may have no allocations, thus no GC, But others clearly create temporary objects.


Could they go on the stack if not returned in any way (return value, set as input obj property, in closure, etc)? Is there an immediate mode GC that is similar to the stack approach?


I ask because as lovely as these features are, last time I did a 3 week performance study of http://agentscript.org, it turned out that 12-15% of the CPU was GC! Being more careful, and reusing arrays, reduced it to less than 4%


Thanks again, really useful.

Axel Rauschmayer said...

babeljs is a great way to start.

Axel Rauschmayer said...

It's worth mentioning that 6to5 has been renamed to babeljs so you might want to update that there.