Async/await: It’s Good and Bad
medium.com
medium.com
If you can get away with ignoring IE and Safari, the latest versions of Edge, Firefox, Chrome, and Opera all have native support for promises and generators, which can implement async/await style concurrency much more tersely: https://babeljs.io/docs/plugins/transform-async-to-generator...
There's also Kneden (https://github.com/marten-de-vries/kneden) which, combined with a Promise polyfill, should transpile async/await into relatively clean chains of promises.
A benefit the author didn't quite touch on is what a boon async/await is for branching processes. I've got a block of logic that takes credit card info for Stripe, and it needs to validate user info, tokenize payment info, add it to the user model, and then add the tokenized card to the Stripe customer associated with the card. There are a lot of places this can go wrong or data can fail a validation. In promises, branching mid-flow is a huge pain.
The much more interesting issue with callback-driven approach to async, no matter what the sugar, was raised by http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y....
In time, we'll not see this code as it'll all happen within the javascript engines, but all features of javascript are still abstractions over lower level code.
How about writing a loop over asynchronous functions? Now that is unpleasant to look at, and most examples I've seen use recursion which is pretty limiting.
That is one of the best reasons to embrace async/await
We use Typescript and I don't care what the final Javascript looks like. I don't plan to ever touch that code manually.
That said, I'm a fan of async/await -- just not yet for projects where I need to optimize for filesize.