Pressed by the web sing of writing asynchronous, event-pushed
code, mainstream languages luxuriate in currently been
constructing in enhance for a unfold of developed take care of watch over-waft aspects.
Meanwhile, experimental language designs luxuriate in suggested
enact handlers as a unifying resolution to programmer-defined
take care of watch over effects, subsuming exceptions, generators, and
Nonetheless, no topic these traits, advanced take care of watch over waft—in
particular, take care of watch over waft that shows a bidirectional
sample—stays aggravating to administer.
We introduce bidirectional algebraic effects, a original programming
abstraction that helps bidirectional take care of watch over transfer in a
more natural approach.
Handlers of bidirectional effects can lift additional effects to
transfer take care of watch over lend a hand to the positioning the build the initiating enact changed into
raised, and can use themselves to take care of their very luxuriate in effects.
We divulge applications of this expressive strength, which falls out
naturally as we push toward the unification of effectful
programming with object-oriented programming.
We pin down the mechanism and the unification formally the utilization of a core language that
makes generalizations to enact operations and enact handlers.
The identical old propagation semantics of take care of watch over effects equivalent to exceptions
conflicts with modular reasoning in the presence of enact polymorphism—it
breaks parametricity. Bidirectionality exacerbates the design back.
Hence, we position out to mark the core language, which builds on the
reward tunneling semantics for algebraic effects, is not handiest
kind-win (no effects trip unhandled), but also
abstraction-win (no effects are unintentionally handled).
We devise a step-listed logical-members of the family model, and procure
its parametricity and soundness proofs.
These core results are fully mechanized in Coq.
Whereas a fat-featured compiler is left to future work,
experiments mark that as a first-class language feature,
bidirectional handlers might per chance well well also additionally be implemented effectively.
The closing paper is not but ready for distribution. It
shall be made available from this web sing.