News for hackers. Stuff that matters.
Re:Asynchronous Everything (2015) by toast0 on Sunday June 13, 2021 @10:16PM (#27498596)
Async/await is awkward (or has been in languages I've used it in), but I don't think it's because of the await.

It's because await foo(); (or however you write it) doesn't tend to act the same as a synchronous function, even though that's what you're asking for. Because you called an async function, even though you immediately await the results, now your function is async, and it cascades up the chain, but often you need to provide a non-async interface, so then you're really stuck.

Javascript has an inflexible execution model, so you kind of need to take what you can get, but I prefer an explicit threadish thing plus async messaging. In your thread, you can (async) message another thread (or spawn a thread with an initial message) and wait for a response when you're ready to block, which could be immediately... or just send the message and loop on incoming messages to react appropriately if you get a reply.

Re:Asynchronous Everything (2015) by eyelidlessness on Monday June 14, 2021 @12:02AM (#27499178)
> It's because await foo(); (or however you write it) doesn't tend to act the same as a synchronous function, even though that's what you're asking for. Because you called an async function, even though you immediately await the results, now your function is async, and it cascades up the chain, but often you need to provide a non-async interface, so then you're really stuck.

As far as I'm aware of, this is pretty standard for language-level concurrency sugar. It's syntactically blocking in that it allows you to write code without callbacks/message handlers, but it's infectious up the call stack.