High-level effect handlers in C++
Dan R. Ghica, Sam Lindley, Marcos Maroñas Bravo, Maciej Piróg
摘要
Effect handlers allow the programmer to implement computational effects, such as custom error handling, various forms of lightweight concurrency, and dynamic binding, inside the programming language. We introduce cpp-effects, a C++ library for effect handlers with a typed high-level, object-oriented interface. We demonstrate that effect handlers can be successfully applied in imperative systems programming languages with manual memory management. Through a collection of examples, we explore how to program effectively with effect handlers in C++, discuss the intricacies and challenges of the implementation, and show that despite its limitations, cpp-effects performance is competitive and in some cases even outperforms state-of-the-art approaches such as C++20 coroutines and the libmprompt library for multiprompt delimited control.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 7 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Effect Handlers for C via Coroutines 引用了 Retrofitting effect handlers onto OCaml
- Effect Handlers for C via Coroutines 引用了 Continuing WebAssembly with Effect Handlers
- Retrofitting effect handlers onto OCaml 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
- Continuing WebAssembly with Effect Handlers 引用了 Retrofitting effect handlers onto OCaml
- Algebraic Effects Meet Hoare Logic in Cubical Agda 引用了 Retrofitting effect handlers onto OCaml
- Soundly Handling Linearity 引用了 Retrofitting effect handlers onto OCaml
- Soundly Handling Linearity 引用了 Continuing WebAssembly with Effect Handlers
- Soundly Handling Linearity 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
引用它的顶会 Paper7
- Continuing WebAssembly with Effect HandlersLuna Phipps-Costin, Andreas Rossberg, Arjun Guha, Daan Leijen 等OOPSLA 2023 · 20 次引用
- Soundly Handling LinearityWenhao Tang, Daniel Hillerström, Sam Lindley, J. Garrett MorrisPOPL 2024 · 8 次引用
- Effect Handlers for C via CoroutinesMario Alvarez-Picallo, Teodoro Freund, Dan R. Ghica, Sam LindleyOOPSLA 2024 · 6 次引用
- Ratte: Fuzzing for Miscompilations in Multi-Level Compilers Using Composable SemanticsPingshi Yu, Nicolas Wu, Alastair F. DonaldsonASPLOS 2025 · 3 次引用
- Algebraic Effects Meet Hoare Logic in Cubical AgdaDonnacha Oisín Kidney, Zhixuan Yang, Nicolas WuPOPL 2024 · 2 次引用
它引用的 Paper2
相关 Paper
- Dynamic Wind for Effect HandlersDavid Voigt, Philipp Schuster, Jonathan Immanuel BrachthäuserOOPSLA 2025
- A typed continuation-passing translation for lexical effect handlersPhilipp Schuster, Jonathan Immanuel Brachthäuser, Marius Müller, Klaus OstermannPLDI 2022 · 10 次引用
- Modal Effect TypesWenhao Tang, Leo White, Stephen Dolan, Daniel Hillerström 等OOPSLA 2025 · 4 次引用
- Tracing Just-in-Time Compilation for Effects and HandlersMarcial Gaißert, Carl Friedrich Bolz-Tereick, Jonathan Immanuel BrachthäuserOOPSLA 2025
- Efficient compilation of algebraic effect handlersGeorgios Karachalias, Filip Koprivec, Matija Pretnar, Tom SchrijversOOPSLA 2021 · 9 次引用
