← Back to context

Comment by afiori

4 days ago

Some come to async from callbacks and others from (green)threads.

If you come from callbacks it is (almost) purely an upgrade, from threads is it more mixed.

Yeah, that's what annoys me, async comes from people who only knew about callbacks and not other forms of inter thread communication.

  • Not true. I’ve used both, and I often prefer the explicitness of async await. It’s easier to reason about. The language guarantees that functions which aren’t async can’t be preempted - and that makes a lot of code much easier to write because you don’t need mutexes, atonics and semaphores everywhere. And that in turn often dramatically improves performance.

    At least in JS. I don’t find async in rust anywhere near as nice to use. But that’s a separate conversation.