A Design Space Exploration of Async/Await
Abstract: Many modern programming languages include some form of asynchronous programming. In particular, a growing number now have what we call straight-line asynchrony: attempts to provide asynchronous functions that look similar to synchronous functions, thereby enabling asynchrony without introducing complex control. These languages often share construct names like “async” and “await,” which…
Many programming languages now offer asynchronous functionality, often in a way that appears similar to synchronous operations. These "straight-line asynchrony" implementations use common terminology like "async" and "await," which hints at underlying similarities. However, a closer look reveals that these languages diverge significantly across various aspects, sometimes in subtle ways.
This paper explores the design space of this type of asynchrony, analyzing several existing languages and highlighting how they differ in key design decisions that impact execution.
The study identifies nine dimensions that span the entire life cycle of an asynchronous computation. These dimensions cover critical questions such as what guarantees a language provides when an asynchronous function is called, what transpires at the end of a task's execution, and how a task can manage cancellation. The authors examine these topics through practical examples, informal discussions, and formal semantics.
The ultimate aim of the research is to enhance understanding among programmers, language designers, and language theorists regarding the current state of straight-line asynchrony. By shedding light on the nuances of these design choices, the paper seeks to clarify the varying behaviors of seemingly similar programs, thereby reducing confusion among developers and language creators.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.