A summary of ECMAScript 6 features
github.com
A summary of ECMAScript 6 features
1–10 of 54 posts
Re: A summary of ECMAScript 6 features
#2Re: A summary of ECMAScript 6 features
#3Now if we can only get the bind operator [1] in a timely manner, everything will be awesome.
[1]: http://wiki.ecmascript.org/doku.php?id=strawman:bind_operato...
Re: A summary of ECMAScript 6 features
#4Awesome list. I'm happy to have saved it. I'd love to see a post about how to easily and quickly start transitioning without a hassle. :)
Getting it to play nicely with my code coverage tool was a bit tricky, but aside from that it wasn't bad at all.
Bear in mind that ES6 is fully backwards-compatible with ES5, so you can set up a transpiler without having to actually rewrite your whole codebase right off the bat. It's pretty easy to upgrade gradually if you need or want to.
Re: A summary of ECMAScript 6 features
#5Despite what people may say, ES6 is turning out to be a pretty great language all around. Type coercion is still pretty annoying and is there to stay, but the new features are all mostly well done. Now if we can only get the bind operator [1] in a timely manner, everything will be awesome. [1]: http://wiki.ecmascript.org/doku.php?id=strawman:bind_operato...
My first impression is that it's kind of confusing to read, but I suspect I'd get used to it.
Sort of similar to some of the destructuring assignment stuff, e.g. `let { address: { street } } = user;`. Awkward at first, but now I'm kind of into it – although I still think people are likely to abuse it.
Re: A summary of ECMAScript 6 features
#6Re: A summary of ECMAScript 6 features
#7A lot of these features look great, and some of them are even useful. I think it's a shame that async/await has to wait for ES7. It would really give some direction to the node community and give JS an edge for async programming. Generators just look like another awkward attempt to avoid callbacks by jumping through different hoops.
There's no reason we'll have to wait for ES7. Seeing as how good 6 to 5 transpilers already are, I'm sure you'll be able to use await relatively soon.
Re: A summary of ECMAScript 6 features
#8A lot of these features look great, and some of them are even useful. I think it's a shame that async/await has to wait for ES7. It would really give some direction to the node community and give JS an edge for async programming. Generators just look like another awkward attempt to avoid callbacks by jumping through different hoops.
Generators have long been used in the Python community for reasons other than callback avoidance (they are lazy sequences). Generators in ES6 (as well as several other features) seem to be inspired by Python. There's no reason we'll have to wait for ES7. Seeing as how good 6 to 5 transpilers already are, I'm sure you'll be able to use await relatively soon.
Also, Traceur got a patch in master for async generator functions earlier this week.
Re: A summary of ECMAScript 6 features
#9A lot of these features look great, and some of them are even useful. I think it's a shame that async/await has to wait for ES7. It would really give some direction to the node community and give JS an edge for async programming. Generators just look like another awkward attempt to avoid callbacks by jumping through different hoops.
Generators have long been used in the Python community for reasons other than callback avoidance (they are lazy sequences). Generators in ES6 (as well as several other features) seem to be inspired by Python. There's no reason we'll have to wait for ES7. Seeing as how good 6 to 5 transpilers already are, I'm sure you'll be able to use await relatively soon.
I just feel like priority-wise, users would benefit most from modules (which made it), async/await, maybe class syntactic sugar, then everything else.
Re: A summary of ECMAScript 6 features
#10Now there's a completely new function syntax that doesn't use parens and has different scope rules
var odds = evens.map(v => v + 1);
Enhanced object literals: // Computed (dynamic) property names
[ 'prop_' + (() => 42)() ]: 42
what?? So it uses parens if there are no params, but not otherwise?Template Strings:
`In JavaScript this is
not legal.`
Seriously another String delimiter? `Hello ${name}, how are you ${time}?`
Why aren't we just using #{} like everyone else? // Construct an HTTP request prefix is used to interpret the replacements and construction
GET`http://foo.org/bar?a=${a}&b=${b}...
What??Destructuring:
var [a, , b] = [1,2,3];
Is that seriously just whitespace and another comma?Splats (spreads?)
f(...[1,2,3]) == 6
... means destructure?This is not readable code:
let fibonacci = {
[Symbol.iterator]() {
let pre = 0, cur = 1;
return {
next() {
[pre, cur] = [cur, pre + cur];
return { done: false, value: cur }
}
}
}
}
for (var n of fibonacci) {
// truncate the sequence at 1000
if (n > 1000)
break;
print(n);
}
Symbols without a literal syntax: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Jesus Christ.Unicode:
"𠮷".length == 2
Awesome, still wrong.Modules are cool. Promises are cool. Tail call optimization is cool.
This is not readable code:
// Proxying a normal object
var target = {};
var handler = {
get: function (receiver, name) {
return `Hello, ${name}!`;
}
};
var p = new Proxy(target, handler);
p.world === 'Hello, world!';
ES6 is a mess. Javascript just got harder.