News for hackers. Stuff that matters.
Re:JavaScript's world domination by timepiece on Tuesday March 24, 2015 @07:02PM (#9260148)
Can't you use promises/deferreds instead?
Re:JavaScript's world domination by ufo on Tuesday March 24, 2015 @07:16PM (#9260230)
One thing yield/await does is that if plays nice with existing control-flow mechanisms in the language. You can put them inside a for loop, if statement, try-catch block, etc. With promises all of those have to be reimplemented in a library and all your code needs to be converted to the "promisified" version of things.

The different syntax also prevents you from creating functions that can be reused by both sync and async code.

The big thing promises and other callback-based control flow libraries do is that they fix exception handling in async code (its a PITA to add error handlers in every callback when writing async code by hand). They also let you avoid some of the awkward "pyramid of doom" nesting but thats not really killer feature because you can also achieve that by using tons of named functions.

Re:JavaScript's world domination by tracker1 on Wednesday March 25, 2015 @03:21AM (#9261646)
async/await are coming with ES7 and available today with BabelJS and other transpilers. Though not part of core, they rely on thenables/promises, which handle the reject/resolve which get composed with generators.

The required bits are in place... alternatively you can use co/koa which uses generators along with yeilding promises to act in a similar fashion.. it does work pretty well, and will only get better.

Re:JavaScript's world domination by barosl on Tuesday March 24, 2015 @07:09PM (#9260196)
I do think promise and deferred are huge improvements to ergonomics, but still... I cannot completely love the code bloat (which is much smaller and easier to reason about than callback hell, of course) that is caused by those libraries. I much prefer Haskell's monadic interface or Python's `yield from`. But that may be my personal preference.
Re:JavaScript's world domination by timepiece on Tuesday March 24, 2015 @07:13PM (#9260217)
Grownups in charge of the lang are listening and they're doing their best to incorporate these features (async/yield) in the language as soon as possible.

Don't despair the future is bright :)