Any views expressed within media held on this service are those of the contributors, should not be taken as approved or endorsed by the University, and do not necessarily reflect the views of the University in respect of any particular issue.

Upcoming paper in OOPSLA: Higher Level Effect Handlers in C++

High-Level Type-Safe Effect Handlers in C++

DAN GHICA, Huawei Research, UK
SAM LINDLEY, The University of Edinburgh, UK
MACIEJ PIRÓG, Huawei Research, UK

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 type- and memory-safe C++ library for effect handlers with a high-level, objectoriented 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 circumstances even outperforms state-of-the-art approaches such as C++20 coroutines and the libmprompt library for multiprompt delimited control.

Preprint: cppeff-draft-april2022



Report this page

To report inappropriate content on this page, please use the form below. Upon receiving your report, we will be in touch as per the Take Down Policy of the service.

Please note that personal data collected through this form is used and stored for the purposes of processing this report and communication with you.

If you are unable to report a concern about content via this form please contact the Service Owner.

Please enter an email address you wish to be contacted on. Please describe the unacceptable content in sufficient detail to allow us to locate it, and why you consider it to be unacceptable.
By submitting this report, you accept that it is accurate and that fraudulent or nuisance complaints may result in action by the University.