Abstract
AbstractStructuring control flow is an essential task almost every programmer faces on a daily basis. At the same time, the control flow of software applications is becoming increasingly complicated, motivating languages to include more and more features like asynchronous programming and generators. Effect handlers are a promising alternative since they can express many of these features as libraries. To bring effect handlers closer to the software engineering practice, we present capability passing as an implementation technique for effect handlers. Capability passing provides the basis for the integration of effect handlers into mainstream object-oriented programming languages and thereby unlocks novel modularization strategies. It also enables programmers to apply lexical reasoning about effects and gives rise to a new form of effect polymorphism. Finally, it paves the path for efficient compilation strategies of control effects.
Highlights
Structuring control flow is an essential task almost every programmer faces on a daily basis
The control-flow mechanisms offered by modern programming languages range from simple local control-flow mechanisms, such as conditional branching and loops, to more complex constructs that enable non-local control flow transfers, such as exceptions, asynchronous programming, generators, fibers, and many more
The focus of this chapter is on capabilities and capability passing—for a detailed study of the newly gained extensibility and modularity by combining objectoriented programming with effect handlers, we refer the interested reader to Chapter 4 of [11]
Summary
Structuring control flow is an essential task almost every programmer faces on a daily basis. Compiler engineers have to optimize the runtime performance of every single construct This is challenging on platforms with just-in-time (JIT) compilation like JavaScript and Java, since in those languages the features need to be implemented in both the interpreter and the compiler. It has been shown that effect handlers can express many of the aforementioned features as libraries This includes exceptions [34], asynchronous programming [1, 36], generators [7, 34], cooperative multitasking [18, 21], and many more. Expressing those mechanisms as libraries instead of building them into a language has multiple advantages: Programmers only need to learn and understand one language feature instead of a multitude of different features. We discuss how the implementation technique of capability passing can contribute to improve on the abovementioned problems
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.