...
首页> 外文期刊>Science of Computer Programming >Typing and semantics of asynchronous arrows in JavaScript
【24h】

Typing and semantics of asynchronous arrows in JavaScript

机译:JavaScript中异步箭头的输入和语义

获取原文
获取原文并翻译 | 示例
           

摘要

Asynchronous programs in JavaScript using callbacks and promises are difficult to write correctly. Many programs have subtle errors due to the unwanted interaction of event handlers. To fix such errors, the programmer is burdened with explicit registration and de-registration of event handlers. This produces fragile code which is difficult to read and maintain. Arrows, a generalization of monads, are an elegant solution to asynchronous program composition. In this paper, we present the semantics of an arrow-based DSL in JavaScript which can encode asynchronous programs as a state machine where edge transitions are triggered by external events. To ensure that arrows are composed correctly, we provide an optional type checker that reports errors before the machine begins execution.
机译:JavaScript中使用回调和Promise的异步程序很难正确编写。由于事件处理程序的不必要交互,许多程序都有细微的错误。为了解决这些错误,程序员要负担事件处理程序的显式注册和注销。这产生了难以阅读和维护的易碎代码。箭头是monad的概括,是异步程序合成的一种优雅解决方案。在本文中,我们介绍了JavaScript中基于箭头的DSL的语义,该语义可以将异步程序编码为状态机,其中边缘转换由外部事件触发。为了确保箭头正确地组成,我们提供了一个可选的类型检查器,该检查器在机器开始执行之前报告错误。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号