可重用语言组件的潜在影响:扩展版本
Latent Effects for Reusable Language Components: Extended Version
摘要:
程序设计语言的开发可能相当复杂和昂贵。因此,许多努力都致力于语言功能的模块化定义,可以在各种组合中重用,以定义新的语言并对其语义进行实验。这些努力的一个显著成果是基于代数的“点菜数据库”方法。当与代数效应相结合时,DTC可以对广泛的公共语言特征进行建模。不幸的是,目前的技术水平不包括高级控制流机制的模块化定义,这些机制将执行推迟到适当的点,例如按名称调用和按需要调用评估以及(多)分段。本文定义了潜在的影响,一类通用的控制流机制。我们演示了函数抽象,懒惰计算和MetaML的分期都可以表示在一个模块化的方式使用潜在的影响,以及如何将它们以各种方式组合起来,以获得复杂的语义。我们提供了我们的效果和处理程序的完整Haskell实现,并提供了一系列示例。
英文摘要:
The development of programming languages can be quite complicated and costly. Hence, much effort has been devoted to the modular definition of language features that can be reused in various combinations to define new languages and experiment with their semantics. A notable outcome of these efforts is the algebra-based "datatypes a la carte" (DTC) approach. When combined with algebraic effects, DTC can model a wide range of common language features. Unfortunately, the current state of the art does not cover modular definitions of advanced control-flow mechanisms that defer execution to an appropriate point, such as call-by-name and call-by-need evaluation, as well as (multi-)staging. This paper defines latent effects, a generic class of such control-flow mechanisms. We demonstrate how function abstractions, lazy computations and a MetaML-like staging can all be expressed in a modular fashion using latent effects, and how they can be combined in various ways to obtain complex semantics. We provide a full Haskell implementation of our effects and handlers with a range of examples.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。