paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Abstraction-safe effect handlers via tunneling

通过隧道实现抽象安全的效应处理器
POPL 3(POPL)2019匹配度 2/10 · 论文研究代数效应处理器的类型安全与抽象安全,属于编程语言形式语义/类型系统,但未涉及静态分析、机器学习系统、Agentic 程序、LLM 或浮点/贝叶斯程序分析,与画像核心方向基本无关。引用 45 inbox
Yizhou Zhang, Andrew C. Myers
crossref: 2026-09-10

AI 速览

一句话:提出隧道语义,使高阶效应多态代码不会意外处理传入函数引发的效应,从而保证效应处理器既类型安全又抽象安全。

代数效应处理器可统一异常、迭代与 async/await 等控制流,但以往的类型安全设计不支持高阶抽象的模块化推理:高阶效应多态代码可能意外处理传入函数引发的效应。本文提出“隧道”语义,核心是代码只处理自己感知的效应;传入函数引发的效应会穿过对其多态的高阶调用者,而不会被意外捕获,同时类型系统仍保证所有效应最终被处理。作者证明该设计不仅类型安全而且抽象安全,并建立相对于上下文等价可靠的逻辑关系模型,导出此前无法得到的程序等价结果,为兼具强抽象保证的效应处理器语言设计提供了可行方案。

问题
高阶代数效应处理器的既有设计难以保证抽象安全:高阶效应多态代码可能意外处理传入函数引发的效应,破坏模块化推理。
方法
提出隧道语义,使代码只处理自身感知的效应,传入函数引发的效应穿过对其多态的高阶调用者;用类型系统保证所有效应最终被处理,并以逻辑关系模型证明类型安全与抽象安全。
评估
通过逻辑关系模型相对于上下文等价证明其可靠性,并由此导出此前无法得到的程序等价结果,说明强抽象保证的可行性。
原文摘要(Abstract)

Algebraic effect handlers offer a unified approach to expressing control-flow transfer idioms such as exceptions, iteration, and async/await. Unfortunately, previous attempts to make these handlers type-safe have failed to support the fundamental principle of modular reasoning for higher-order abstractions. We demonstrate that abstraction-safe algebraic effect handlers are possible by giving them a new semantics. The key insight is that code should only handle effects it is aware of. In our approach, the type system guarantees all effects are handled, but it is impossible for higher-order, effect-polymorphic code to accidentally handle effects raised by functions passed in; such effects tunnel through the higher-order, calling procedures polymorphic to them. By contrast, the possibility of accidental handling threatens previous designs for algebraic effect handlers. We prove that our design is not only type-safe, but also abstraction-safe. Using a logical-relations model that we prove sound with respect to contextual equivalence, we derive previously unattainable program equivalence results. Our mechanism offers a viable approach for future language designs aiming for effect handlers with strong abstraction guarantees.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot669,
  title = {Abstraction-safe effect handlers via tunneling},
  author = {Yizhou Zhang and Andrew C. Myers},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {3},
  number = {POPL},
  year = {2019},
  doi = {10.1145/3290318}
}