Lexical Effect Handlers, Directly
Cong Ma, Zhaoyi Ge, Edward Lee, Yizhou Zhang
摘要
Lexically scoping effect handlers is a language-design idea that equips algebraic effects with a modular semantics: it enables local-reasoning principles without giving up on the control-flow expressiveness that makes effect handlers powerful. However, we observe that existing implementations risk incurring costs akin to the run-time search for dynamically scoped handlers. This paper presents a compilation strategy for lexical effect handlers, adhering to the lexical scoping principle and targeting a language with low-level control over stack layout. Key aspects of this approach are formalized and proven correct. We embody the ideas in a language called L exa : the L exa compiler translates high-level effect handling to low-level stack switching. We evaluate the L exa compiler on a set of benchmarks; the results suggest that it generates efficient code, reducing running-time complexity from quadratic to linear in some cases.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 5 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Retrofitting effect handlers onto OCaml 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
- Qualified Types with Boolean Algebras 引用了 Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back
- Qualified Types with Boolean Algebras 引用了 Effects as capabilities: effect handlers and lightweight effect polymorphism
- Zero-Overhead Lexical Effect Handlers 引用了 Retrofitting effect handlers onto OCaml
- Zero-Overhead Lexical Effect Handlers 引用了 Continuing WebAssembly with Effect Handlers
- Zero-Overhead Lexical Effect Handlers 引用了 Effects as capabilities: effect handlers and lightweight effect polymorphism
- 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 引用了 Effects as capabilities: effect handlers and lightweight effect polymorphism
- 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
- Classifying Capabilities 引用了 Effects as capabilities: effect handlers and lightweight effect polymorphism
- Virtualizing Continuations 引用了 Retrofitting effect handlers onto OCaml
- 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
- Continuing WebAssembly with Effect Handlers 引用了 Retrofitting effect handlers onto OCaml
- Effects as capabilities: effect handlers and lightweight effect polymorphism 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
- Tracing Just-in-Time Compilation for Effects and Handlers 引用了 Retrofitting effect handlers onto OCaml
- Tracing Just-in-Time Compilation for Effects and Handlers 引用了 Continuing WebAssembly with Effect Handlers
- Tracing Just-in-Time Compilation for Effects and Handlers 引用了 Effects as capabilities: effect handlers and lightweight effect polymorphism
- Tracing Just-in-Time Compilation for Effects and Handlers 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
引用它的顶会 Paper5
- Zero-Overhead Lexical Effect HandlersCong Ma, Zhaoyi Ge, Max Jung, Yizhou ZhangOOPSLA 2025 · 2 次引用
- Qualified Types with Boolean AlgebrasEdward Lee, Jonathan Lindegaard Starup, Ondrej Lhoták, Magnus MadsenOOPSLA 2025 · 1 次引用
- Classifying CapabilitiesCao Nguyen Pham, Oliver Bračevac, Yichen Xu, Yaoyu Zhao 等OOPSLA 2026
- Virtualizing ContinuationsCong Ma, Jonghyun Jung, Yizhou ZhangPLDI 2026
- Tracing Just-in-Time Compilation for Effects and HandlersMarcial Gaißert, Carl Friedrich Bolz-Tereick, Jonathan Immanuel BrachthäuserOOPSLA 2025
它引用的 Paper10
- Effects as capabilities: effect handlers and lightweight effect polymorphismJonathan Immanuel Brachthäuser, Philipp Schuster, Klaus OstermannOOPSLA 2020 · 62 次引用
- Retrofitting effect handlers onto OCamlK. C. Sivaramakrishnan, Stephen Dolan, Leo White, Tom Kelly 等PLDI 2021 · 56 次引用
- Binders by day, labels by night: effect instances via lexically scoped handlersDariusz Biernacki, Maciej Piróg, Piotr Polesiuk, Filip SieczkowskiPOPL 2020 · 46 次引用
- 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 次引用
- Continuing WebAssembly with Effect HandlersLuna Phipps-Costin, Andreas Rossberg, Arjun Guha, Daan Leijen 等OOPSLA 2023 · 20 次引用
相关 Paper
- Dynamic Wind for Effect HandlersDavid Voigt, Philipp Schuster, Jonathan Immanuel BrachthäuserOOPSLA 2025
- Efficient compilation of algebraic effect handlersGeorgios Karachalias, Filip Koprivec, Matija Pretnar, Tom SchrijversOOPSLA 2021 · 9 次引用
- A typed continuation-passing translation for lexical effect handlersPhilipp Schuster, Jonathan Immanuel Brachthäuser, Marius Müller, Klaus OstermannPLDI 2022 · 10 次引用
- First-class names for effect handlersNingning Xie, Youyou Cong, Kazuki Ikemori, Daan LeijenOOPSLA 2022 · 11 次引用
- Hefty Algebras: Modular Elaboration of Higher-Order Algebraic EffectsCasper Bach Poulsen, Cas van der RestPOPL 2023 · 9 次引用
