Remix.run Logo
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.

nottorp 3 days ago | parent [-]

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

josephg 5 hours ago | parent [-]

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.