proposal-async-context: Async Context for JavaScript
9 points by hibachrach
9 points by hibachrach
Crazy how primitive this is still.
Using async in c# (original implementation of this pattern in a widely used language) makes me nash my teeth in JS.
C# has structured async and cancelations ate easy to propagate. It makes it easy to respond to user leaving or canceling long running requests or handling timeouts from other system calls etc.
In JS we get...AbortController.
CancelationTokens in C# are very nice and supported almost everywhere in async vice with an optional param. They are composable so you can cancel a single operation for multiple reasons - say is the user disconnected or they clicked "Cancel" or the dB call timed out etc.
Just boggles my mind why they didn't just steal the whole implementation.
Python's async is also cludgy but in different ways.
This took us a bit too long, imo. Together with decorators.
It feels like we need again a refresher like WHATWG once was over W3C.