A model for reasoning about JavaScript promises
A model for reasoning about JavaScript promises
复制标题
JavaScript Promise 的推理模型
DOI:
10.1145/3133910
复制
发表时间:
2017
影响因子:
--
通讯作者:
Tip, Frank
中科院分区:
文献类型:
--
作者:
Madsen, Magnus;Lhoták, Ondřej;Tip, Frank
In JavaScript programs, asynchrony arises in situations such as web-based user-interfaces, communicating with servers through HTTP requests, and non-blocking I/O. Event-based programming is the most popular approach for managing asynchrony, but suffers from problems such as lost events and event races, and results in code that is hard to understand and debug. Recently, ECMAScript 6 has added support for promises, an alternative mechanism for managing asynchrony that enables programmers to chain asynchronous computations while supporting proper error handling. However, promises are complex and error-prone in their own right, so programmers would benefit from techniques that can reason about the correctness of promise-based code.Since the ECMAScript 6 specification is informal and intended for implementers of JavaScript engines, it does not provide a suitable basis for formal reasoning. This paper presents λp, a core calculus that captures the essence of ECMAScript 6 promises. Based on λp, we introduce the promise graph, a program representation that can assist programmers with debugging of promise-based code. We then report on a case study in which we investigate how the promise graph can be helpful for debugging errors related to promises in code fragments posted to the StackOverflow website.
登录
查看更多内容
DOI:
--
发表时间:
1995
期刊:
ACM-SIGACT Symposium on Principles of Programming Languages
影响因子:
--
作者:
C. Flanagan;M. Felleisen
通讯作者:
M. Felleisen
DOI:
10.1007/978-3-642-54807-9_12
发表时间:
2014-04
期刊:
--
影响因子:
--
作者:
Magnus Madsen;Esben Andreasen
通讯作者:
Magnus Madsen;Esben Andreasen
DOI:
--
发表时间:
2008
期刊:
Asian Symposium on Programming Languages and Systems
影响因子:
--
作者:
S. Maffeis;John C. Mitchell;Ankur Taly
通讯作者:
Ankur Taly
DOI:
--
发表时间:
2009
期刊:
影响因子:
--
作者:
M. Felleisen;R. Findler;M. Flatt
通讯作者:
M. Flatt
DOI:
--
发表时间:
2014
期刊:
Conference on Object-Oriented Programming Systems, Languages, and Applications
影响因子:
--
作者:
Esben Andreasen;Anders Møller
通讯作者:
Anders Møller