3 ms·
This is a really interesting point. You almost never hear async function coloring being conceptualized as a feature rather than a hindrance. Async function colo
by throwitaway1123 2y ago
This is a really interesting point. You almost never hear async function coloring being conceptualized as a feature rather than a hindrance. Async function coloring is kind of analogous to the borrow checker in Rust. It makes you think about concurrency the same way that the borrow checker makes you think about memory ownership and lifetimes.
- bloppe 2y agoasync is a great feature if you use it from square 1. If you start with a legacy codebase using callbacks and try to port it incrementally to async, you're gonna have a bad time. Otherwise, it's definitely a feature
- throwitaway1123 2y agoYeah upgrading a legacy codebase that uses callbacks is not fun, but if the callback functions follow the Node error first value second convention, then it's a little bit easier because you can just use `util.promisify` to convert them to promises in Node. There's also the new Promise.withResolvers method which helps a bit too [1]. [1] https://github.com/tc39/proposal-promise-with-resolvers https://github.com/tc39/proposal-promise-with-resolvers