Implementation Techniques for Lexical Effect Handlers

dc.contributor.authorMa, Cong
dc.date.accessioned2026-08-10T13:06:47Z
dc.date.issued2026-08-10
dc.date.submitted2026-07-21
dc.description.abstractEffect handlers generalize exception handling to support control-flow patterns including coroutines, cooperative multitasking, and nondeterminism. Recent work advocates for lexically scoped handlers, which restore abstraction safety and enable modular reasoning: a handler is a lexically scoped capability, and an effect can be raised only to a handler whose capability is in scope. However, prior implementations of lexical effect handlers suffer from inefficiencies that could hinder their adoption in practice. This thesis shows that the static character that makes lexical scoping safe is also what makes it efficient to implement. It develops this insight into three complementary compilation techniques, embodied in our language Lexa; each technique is made precise by a formal model, proven correct, and realized in the Lexa compiler. Direct Lexa identifies each handler with the stack address where it is installed, so a raise jumps directly to its handler, without any search. Zone Lexa extends the address-based strategy to multishot resumptions by virtualizing handler identities through a software memory-management unit. Zero Lexa serves infrequent effects such as exceptions: it avoids the cost of passing down any run-time handler identity, and instead walks the stack using the static handler provenance information when an effect is raised, so effect-free execution pays nothing. A single program can choose among the three techniques per effect, matching each declared effect to its expected usage. Together, these techniques demonstrate that lexical effect handlers can be implemented efficiently. Effect handlers can be both safe and fast.
dc.identifier.urihttps://hdl.handle.net/10012/23936
dc.language.isoen
dc.pendingfalse
dc.publisherUniversity of Waterlooen
dc.subjectprogramming languages
dc.subjectcompilers
dc.subjecteffect handlers
dc.subjecttype systems
dc.subjectsemantics
dc.subjectcompiler verification
dc.titleImplementation Techniques for Lexical Effect Handlers
dc.typeDoctoral Thesis
uws-etd.degreeDoctor of Philosophy
uws-etd.degree.departmentDavid R. Cheriton School of Computer Science
uws-etd.degree.disciplineComputer Science
uws-etd.degree.grantorUniversity of Waterlooen
uws-etd.embargo.terms0
uws.contributor.advisorZhang, Yizhou
uws.contributor.affiliation1Faculty of Mathematics
uws.peerReviewStatusUnrevieweden
uws.published.cityWaterlooen
uws.published.countryCanadaen
uws.published.provinceOntarioen
uws.scholarLevelGraduateen
uws.typeOfResourceTexten

Files

Original bundle

Now showing 1 - 1 of 1
Loading...
Thumbnail Image
Name:
Ma_Cong.pdf
Size:
1.19 MB
Format:
Adobe Portable Document Format

License bundle

Now showing 1 - 1 of 1
Loading...
Thumbnail Image
Name:
license.txt
Size:
6.4 KB
Format:
Item-specific license agreed upon to submission
Description:

Collections