r/SoftwareEngineering • u/fagnerbrack • 13d ago
A Design Space Exploration of Async/Await
https://cel.cs.brown.edu/blog/design-space-async-await/
11
Upvotes
r/SoftwareEngineering • u/fagnerbrack • 13d ago
4
u/Intrepid-Anywhere255 13d ago
The big product lesson here is that async/await syntax hides runtime contracts: who owns a spawned task, what happens on shutdown, and where its failures surface. For background work in a service, Iād make task lifetime and cancellation explicit and test those paths, because a fire-and-forget task can disappear or outlive the request depending on the runtime. A short checklist comparing those semantics across your stack would help teams choose a runtime and review code.
2
u/fagnerbrack 13d ago
Don't have time to read? Here's the brief:
Async/await differs far more across languages than most developers assume. A tiny program that spawns a background log write without awaiting it prints four different outputs across seven runtimes (JavaScript, C#, Swift, Tokio, Smol, Asyncio, Trio), and no two agree on three variations. The paper identifies nine semantic design dimensions covering task start (eagerness, suspension), end of life (extent, reference strength, destruction, error propagation) and cancellation (awareness, direction, persistence). Swift and Trio both tie tasks to their spawning scope, yet Swift cancels the task and prints "AC" while Trio waits and prints "ABC". A formal calculus traces each divergence.
If the summary seems inacurate, just downvote and I'll try to delete the comment eventually š
Click here for more info, I read all comments