Lune

OOPSLA2020顶会

Handling bidirectional control flow

Yizhou Zhang, Guido Salvaneschi, Andrew C. Myers

摘要

Pressed by the difficulty of writing asynchronous, event-driven code, mainstream languages have recently been building in support for a variety of advanced control-flow features. Meanwhile, experimental language designs have suggested effect handlers as a unifying solution to programmer-defined control effects, subsuming exceptions, generators, and async-await. However, despite these trends, complex control flow-in particular, control flow that exhibits a bidirectional pattern-remains challenging to manage.

We introduce bidirectional algebraic effects, a new programming abstraction that supports bidirectional control transfer in a more natural way. Handlers of bidirectional effects can raise further effects to transfer control back to the site where the initiating effect was raised, and can use themselves to handle their own effects. We present applications of this expressive power, which falls out naturally as we push toward the unification of effectful programming with object-oriented programming. We pin down the mechanism and the unification formally using a core language that makes generalizations to effect operations and effect handlers.

The usual propagation semantics of control effects such as exceptions conflicts with modular reasoning in the presence of effect polymorphism-it breaks parametricity. Bidirectionality exacerbates the problem. Hence, we set out to show the core language, which builds on the existing tunneling semantics for algebraic effects, is not only type-safe (no effects go unhandled), but also abstraction-safe (no effects are accidentally handled). We devise a step-indexed logical-relations model, and construct its parametricity and soundness proofs. These core results are fully mechanized in Coq. While a full-featured compiler is left to future work, experiments show that as a first-class language feature, bidirectional handlers can be implemented efficiently.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 6 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Lexical Effect Handlers, Directly 引用了 Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back
  • Lexical Effect Handlers, Directly 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
  • Zero-Overhead Lexical Effect Handlers 引用了 Lexical Effect Handlers, Directly
  • Zero-Overhead Lexical Effect Handlers 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
  • Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
  • On Higher-Order Model Checking of Effectful Answer-Type-Polymorphic Programs 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
  • Virtualizing Continuations 引用了 Lexical Effect Handlers, Directly
  • Virtualizing Continuations 引用了 Zero-Overhead Lexical Effect Handlers
  • Virtualizing Continuations 引用了 Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back
  • Virtualizing Continuations 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper6

  1. Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and backJonathan Immanuel Brachthäuser, Philipp Schuster, Edward Lee, Aleksander Boruch-GruszeckiOOPSLA 2022 · 24 次引用
  2. Lexical Effect Handlers, DirectlyCong Ma, Zhaoyi Ge, Edward Lee, Yizhou ZhangOOPSLA 2024 · 7 次引用
  3. Zero-Overhead Lexical Effect HandlersCong Ma, Zhaoyi Ge, Max Jung, Yizhou ZhangOOPSLA 2025 · 2 次引用
  4. On Higher-Order Model Checking of Effectful Answer-Type-Polymorphic ProgramsTaro Sekiyama, Ugo Dal Lago, Hiroshi UnnoOOPSLA 2025
  5. Virtualizing ContinuationsCong Ma, Jonghyun Jung, Yizhou ZhangPLDI 2026

它引用的 Paper1

  1. Binders by day, labels by night: effect instances via lexically scoped handlersDariusz Biernacki, Maciej Piróg, Piotr Polesiuk, Filip SieczkowskiPOPL 2020 · 46 次引用

相关 Paper

  1. Efficient compilation of algebraic effect handlersGeorgios Karachalias, Filip Koprivec, Matija Pretnar, Tom SchrijversOOPSLA 2021 · 9 次引用
  2. Retrofitting effect handlers onto OCamlK. C. Sivaramakrishnan, Stephen Dolan, Leo White, Tom Kelly 等PLDI 2021 · 56 次引用
  3. Hefty Algebras: Modular Elaboration of Higher-Order Algebraic EffectsCasper Bach Poulsen, Cas van der RestPOPL 2023 · 9 次引用
  4. Handling Higher-Order Effectful Operations with Judgemental Monadic LawsZhixuan Yang, Nicolas WuPOPL 2026
  5. Answer Refinement Modification: Refinement Type System for Algebraic Effects and HandlersFuga Kawamata, Hiroshi Unno, Taro Sekiyama, Tachio TerauchiPOPL 2024 · 8 次引用
黄昏的海面,两侧是细线勾勒的悬崖