Update: All of the Stage 3 proposals below have advanced to Stage 4! 🎉
Additionally, both Async Iteration &
Promise.prototype.finally are set to be discussed for Stage 4. Async Iteration is an expansion on the iterator protocol (think
Symbol.iterator) for the asynchronous resolution of values. This actually could be really interesting / useful for interoperating with Observables, as it provides a pull-based method forasync values, so Async Iteration could provide a useful "seam" between push-based Observables and a pull-based consumer.
Promise.prototype.finally is used to provide a callback after a Promise has resolved. It’s not exactly the same as
try / catch / finally when using
async / await, as the
finally block in that case can contain more
await‘d promises. A lot of Promise libraries have this method, commonly used for cleaning up resources like database connections or turning off a spinner after the request complete. This doesn’t change your usage of
async / await itself, as it’s a prototype method on the Promise object, and they don’t really function the same either.
Regardless, the discussion will definitely be interesting for anyone who’s attending, and I’m curious if TC39 is going merge the guidance or not. My suspicion is no; the decision seems controversial for little to no material benefit for the committee.
The meeting run Tuesday – Thursday of this week, so keep an eye out for any announcements from the committee as they finalize the latest version of ECMAScript.