处理高阶效应
Handling Higher-Order Effects
摘要:
代数效果处理程序是一种编程范式,程序员可以在其中声明自己的语法操作,并使用效果处理程序模块化地定义这些操作的语义。然而,我们不能直接为许多高阶运算(或高阶效应)定义代数效应处理程序,即,以计算为参数的操作。这种高阶效应的例子包括常见的编程特性,如try-catch异常处理程序、函数抽象等等。在本文中,我们提出了一种新的效果处理程序来解决这一缺点。我们的效果处理程序方法与以前的作用域效果处理程序密切相关,后者也支持高阶效果。一个关键的区别是,我们的效果处理程序可以很容易地将单独的(高阶)效果理解为单独的关注点,因为效果不相互作用。相反,效果交互是作用域效果处理程序的默认设置。虽然单独关注点是我们处理程序的默认设置,但也可以在效果交互的地方定义处理程序。
英文摘要:
Algebraic effect handlers is a programming paradigm where programmers can declare their own syntactic operations, and modularly define the semantics of these using effect handlers. However, we cannot directly define algebraic effect handlers for many higher-order operations (or higher-order effects) -- i.e., operations that have computations as parameters. Examples of such higher-order effects include common programming features, such as try-catch exception handlers, function abstraction, and more. In this paper we present a new kind of effect handler that addresses this shortcoming. Our effect handler approach is closely related to previous work on scoped effect handlers, which also supports higher-order effects. A key difference is that our effect handlers make it easy to understand separate (higher-order) effects as separate concerns, since effects do not interact. In contrast, effect interaction is the default with scoped effect handlers. While separate concerns is the default with our handlers, it is also possible to define handlers where effects interact.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。