For the last year, Domenic has been working to bring an implementation of I/O streams to the browser. Meanwhile, designs for a cancelable promise type (sometimes called “tasks”) are starting to form, driven by the needs of web platform APIs. And TC39 has several proposals floating around for more general asynchronous iteration. We’ll learn about these efforts and more, as Domenic guides us through the frontiers of popular libraries, language design, and web standards.
Usual thing is the four quadrant sync/asyc singular/plural. But this is such a gross over-simplification it’s not really useful.
Two axes of interestingness:
Promises represent the eventual result of an asynchronous action, but they are not a representation of the action itself.
Promises are multi-consumer; but consumers can’t cancel the action.
Cancellable promises (“tasks”), appearing in fetch first. Promise subclass where consumers can request cancellation, while still allowing branching etc.
Also adding finally() to all promises (then/catch/finally). Finally always happens where then and catch may not.
Plural+Async… I/O streams, directory listings, sensor readings, events in general… this combination is actually pretty common.
(Extremely concept-dense talk so get into the slides. Lots of good detail on the design decisions that go into writing specs; including the evergreen “how to name it” problem and how to deal with the different points of view… eg. the python mindset vs the C mindset on the committee.)
Lots of inspiration: https://github.com/kriskowal/gtor
Is all this urgent? Mostly not. Streams are pretty urgent so they are working on that as fast as they can go; but many other considerations are interesting and potentially useful but we have usable options in the meantime.