arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

Async/Await 的设计空间探索

A Design Space Exploration of Async/Await

Gavin Gray, Shriram Krishnamurthi, Will Crichton

arXiv 2608.20677首次发表:更新:

AI 中文总结

本文通过剖析现有语言,阐述了涵盖异步计算生命周期的九维度设计空间,旨在帮助相关人员理解直线式异步的新兴格局。

AI 中文摘要

许多现代编程语言都包含某种形式的异步编程,尤其是越来越多的语言现在拥有我们所称的直线式异步:尝试提供与同步函数外观相似的异步函数,从而在不引入复杂控制的情况下实现异步。这些语言通常共享 "async" 和 "await" 等构造名称,这表明它们具有深层的语义相似性。然而,仔细研究后会发现,这些语言在多个维度上存在相当大的差异,且往往是细微的差异。这些差异会产生实际的语义后果:外观相似的程序可能表现出不同的行为,让开发者和语言设计者都感到困惑。因此,本文对直线式异步进行了设计空间探索。我们剖析了几种现有语言,证明它们在影响执行存在性和顺序的设计决策上,没有两种语言整体达成一致。我们阐述了一个涵盖异步计算完整生命周期的九维度设计空间,涉及诸如:语言在调用异步函数时提供的精确保证是什么?任务生命周期结束时会发生什么?任务如何处理被取消的情况?等问题。我们通过具体示例、非正式设计讨论和形式语义来探索这些问题,最终目标是帮助程序员、语言设计者和语言理论家更好地理解直线式异步的新兴格局。

英文摘要

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 suggests that they have deep semantic similarities. Yet, a close examination reveals that these languages are quite different along several dimensions, often subtly. These differences have real semantic consequences: similar-looking programs can exhibit divergent behavior, confusing developers and language designers alike. This paper therefore presents a design space exploration of straight-line asynchrony. We dissect several existing languages, and show how no two of them agree as a whole on design decisions that affect the presence and ordering of execution. We articulate a design space with nine dimensions covering the full lifecycle of an asynchronous computation, covering questions such as: What precise guarantees does a language give upon calling an asynchronous function? What happens at the end of a task's life? How can a task handle being cancelled? We explore these questions through concrete examples, informal design discussion, and a formal semantics. Our ultimate goal is to help programmers, language designers, and language theorists all better understand the emerging landscape of straight-line asynchrony.

DOI:10.1145/3839519

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑