A summary of ECMAScript 6 features
31–40 of 54 posts
Re: A summary of ECMAScript 6 features
#32Re: A summary of ECMAScript 6 features
#33Earlier quoted context omitted.
> I don't think people should be lauding this feature as some kind of solution to callback hell. Then async/await is no solution for it either.
I think: app.get('/thing', function (req, res) { try { await user = db.get({user: req.user}); res.send({user:user}); } catch { res.send(400); } }); beats the hell out of: app.get('/thing', function (req, res) { db.get({user: req.user}, function (err, user) { if (err) return res.send(400); res.send({user:user}); }); }); especially when you have conditionals or loops that can look like: if (user.name == 'abc') { resp =…
app.get('/thing', function (req, res) {
db.get({user: req.user}).done(user => {
res.send({user:user});
}, error => {
res.send(400);
});
});Re: A summary of ECMAScript 6 features
#34ECMAScript 6 is a mess Now 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…
Params are only optional if there is a single parameter.
Re: A summary of ECMAScript 6 features
#35Re: A summary of ECMAScript 6 features
#36Re: A summary of ECMAScript 6 features
#37While a lot of these changes are cool, I'm worried that starting to work with javascript just got a lot harder. Although, I do appreciate the Class foo extends bar {...} syntax, now maybe we can have one simple way of doing inheritance which is readable to someone new to javascript.
* Tagged template strings might have some potential to be abused in interesting ways, since it looks like the tag function doesn't actually have to return a string.
* The Object destructuring/enhanced literals (and the Object rest/spread proposal in ES7) still take a lot of mental energy for me to parse. I'm worried they could be a maintenance liability in large projects, but that remains to be seen.
* Async functions/generators in ES7 will probably take a while to get used to, as well, but I felt the same way about Promises when they were first introduced, and they didn't turn out to be too bad. I don't have an issue with normal Promises/generators, so this might just be a matter of me needing to see the async stuff as a whole instead of the sum of its parts.
Re: A summary of ECMAScript 6 features
#38While a lot of these changes are cool, I'm worried that starting to work with javascript just got a lot harder. Although, I do appreciate the Class foo extends bar {...} syntax, now maybe we can have one simple way of doing inheritance which is readable to someone new to javascript.
A lot of it just feels like cleaner versions of patterns people have been using for a long time. There's a few things I'm worried about: * Tagged template strings might have some potential to be abused in interesting ways, since it looks like the tag function doesn't actually have to return a string. * The Object destructuring/enhanced literals (and the Object rest/spread proposal in ES7) still take a lot of mental e…
This was a pretty explicit goal, what they called 'paving the cow path'
Re: A summary of ECMAScript 6 features
#39Earlier quoted context omitted.
> I don't think people should be lauding this feature as some kind of solution to callback hell. Then async/await is no solution for it either.
I think: app.get('/thing', function (req, res) { try { await user = db.get({user: req.user}); res.send({user:user}); } catch { res.send(400); } }); beats the hell out of: app.get('/thing', function (req, res) { db.get({user: req.user}, function (err, user) { if (err) return res.send(400); res.send({user:user}); }); }); especially when you have conditionals or loops that can look like: if (user.name == 'abc') { resp =…
You are the one who stated generators were no solution to callback hell but async/await was, yet here's what your code looks like with generators:
app.get('/thing', function* (req, res) {
try {
let user = yield* db.get({user: req.user});
res.send({user: user});
} catch {
res.send(400);
}
});
...Re: A summary of ECMAScript 6 features
#40Maybe its just me but the only things that I really like from this document are "Unicode", and "Tail Call", though some other things may be nice, the verbosity is killing me, how many new keywords, synatic constructs, and symbols are coming in with ECMA6? Though I have no say in the matter, for my 2 cents, I just wish they had used ECMA6 to remove things (mainly those listed here: http://johnkpaul.github.io/presentat…