Algebraic Effect Handlers go Mainstream (Dagstuhl Seminar 18172)

Algebraic Effect Handlers go Mainstream (Dagstuhl Seminar 18172)
复制标题

代数效应处理程序成为主流(Dagstuhl 研讨会 18172)

DOI:
--
复制
发表时间:
2018
期刊:
Dagstuhl Reports
影响因子:
--
通讯作者:
Tom Schrijvers
Tom Schrijvers
中科院分区:
--
文献类型:
--
作者:
Sivaramakrishnan Krishnamoorthy Chandrasekaran;Daan Leijen;Matija Pretnar;Tom Schrijvers

文献摘要

被引文献

相似文献

c#、c++或JavaScript等语言通过特殊扩展支持复杂的控制流语句,如异常处理、迭代器(yield),甚至异步(async/await)。对于异常,运行时需要使用异常处理堆栈帧进行扩展。对于迭代器和异步,情况更加复杂,因为编译器需要将常规代码转换为堆栈恢复状态机。此外,这些特性需要按照预期进行交互,例如,finally块不能在迭代器的状态机中被遗忘。所有这些工作都需要再次完成,以便进行下一个控制流抽象。
Languages like C#, C++, or JavaScript support complex control flow statements like exception handling, iterators (yield), and even asynchrony (async/await) through special extensions. For exceptions, the runtime needs to be extended with exception handling stack frames. For iterators and asynchrony, the situation is more involved, as the compiler needs to turn regular code into stack restoring state machines. Furthermore, these features need to interact as expected, e.g. finally blocks must not be forgotten in the state machines for iterators. And all of this work needs to be done again for the next control flow abstraction that comes along. Or we can use algebraic effect handlers! This single mechanism generalizes all the control flow abstractions listed above and more, composes freely, has simple operational semantics, and can be efficiently compiled, since there is just one mechanism that needs to be supported well. Handlers allow programmers to keep the code in direct-style, which is easy to reason about, and empower library writers to implement various high-level abstractions without special extensions. The idea of algebraic effects handlers has already been experimented with in the form of small research languages and libraries in several mainstream languages, including OCaml, Haskell, Clojure, and Scala. The next step, and the aim of this seminar, is to seriously consider adoption by mainstream languages including both functional languages such as OCaml or Haskell, as well as languages like JavaScript and the JVM and .NET ecosystems.