Affiliation:
1. Huawei, UK
2. University of Edinburgh, UK
Abstract
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.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference33 articles.
1. Joe Armstrong , Robert Virding , Claes Wikström , and Mike Williams . 1996. Concurrent Programming in Erlang , Second Edition. Prentice Hall International , Hertfordshire, UK . Joe Armstrong, Robert Virding, Claes Wikström, and Mike Williams. 1996. Concurrent Programming in Erlang, Second Edition. Prentice Hall International, Hertfordshire, UK.
2. Programming with algebraic effects and handlers
3. Abstracting algebraic effects
4. Binders by day, labels by night: effect instances via lexically scoped handlers
5. Pyro: Deep Universal Probabilistic Programming;Bingham Eli;J. Mach. Learn. Res.,2019
Cited by
5 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Stack-Copying Delimited Continuations for Scala Native;Proceedings of the 19th ACM International Workshop on Implementation, Compilation, Optimization of OO Languages, Programs and Systems;2024-09-13
2. Parallel Algebraic Effect Handlers;Proceedings of the ACM on Programming Languages;2024-08-15
3. Algebraic Effects Meet Hoare Logic in Cubical Agda;Proceedings of the ACM on Programming Languages;2024-01-05
4. Soundly Handling Linearity;Proceedings of the ACM on Programming Languages;2024-01-05
5. Continuing WebAssembly with Effect Handlers;Proceedings of the ACM on Programming Languages;2023-10-16