I have mixed feelings but I think this is a net win for JavaScript.
XMLHttpRequest was enhanced with the Fetch API which uses promises. The libraries and methods will eventually catch up in a similar way.
If we stopped here there'd be little reason to ask everyone to promisify their libraries. The promise callback chain was only slightly more easy to read than the callback pyramid of doom. You might say that async/await lowers the explicit complexity vastly and increases the implicit complexity marginally.
the point of promises was to have a standard contract for callbacks, including error handling, and that contract can be passed around, listened on later, etc. It was a drastic improvement over callbacks. Async/await is just minor sugar over that to make your eyes happier. You still need to reason about the code the same way. You still need to remember they're promises (so you can, let say, await Promise.all(...) to avoid waiting on every single step individually). It doesn't really "add" anything. Promises did.
Too bad promises had a lot of glaring flaws that are taking forever to fix (or are unfixable). We're just getting to the point where unhandled errors are dealt with properly. Composing promises with non-promise constructs still suck. There's still only 2 paths (success and error). The flatMapLatest scenario still suck.
Still, promises were the improvement. Async/await is just sugar.
Comments
I have mixed feelings but I think this is a net win for JavaScript.
XMLHttpRequest was enhanced with the Fetch API which uses promises. The libraries and methods will eventually catch up in a similar way.
If we stopped here there'd be little reason to ask everyone to promisify their libraries. The promise callback chain was only slightly more easy to read than the callback pyramid of doom. You might say that async/await lowers the explicit complexity vastly and increases the implicit complexity marginally.
the point of promises was to have a standard contract for callbacks, including error handling, and that contract can be passed around, listened on later, etc. It was a drastic improvement over callbacks. Async/await is just minor sugar over that to make your eyes happier. You still need to reason about the code the same way. You still need to remember they're promises (so you can, let say, await Promise.all(...) to avoid waiting on every single step individually). It doesn't really "add" anything. Promises did.
Too bad promises had a lot of glaring flaws that are taking forever to fix (or are unfixable). We're just getting to the point where unhandled errors are dealt with properly. Composing promises with non-promise constructs still suck. There's still only 2 paths (success and error). The flatMapLatest scenario still suck.
Still, promises were the improvement. Async/await is just sugar.