Dependence-driven delimited CPS transformation for JavaScript
-
Published:2017-05-12
Issue:3
Volume:52
Page:59-69
-
ISSN:0362-1340
-
Container-title:ACM SIGPLAN Notices
-
language:en
-
Short-container-title:SIGPLAN Not.
Author:
Philips Laure1,
De Koster Joeri1,
De Meuter Wolfgang1,
De Roover Coen1
Affiliation:
1. Vrije Universiteit Brussel, Belgium
Abstract
In today’s web applications asynchronous requests to remote services using callbacks or futures are omnipresent. The continuation of such a non-blocking task is represented as a callback function that will later be called with the result of the request. This style of programming where the remainder of a computation is captured in a continuation function is called continuation-passing style (CPS). This style of programming can quickly lead to a phenomenon called “call- back hell”, which has a negative impact on the maintain- ability of applications that employ this style. Several alter- natives to callbacks are therefore gaining traction within the web domain. For example, there are a number of frameworks that rely on automatically transforming sequential style code into the continuation-passing style. However, these frame- works often employ a conservative approach in which each function call is transformed into CPS. This conservative approach can sequentialise requests that could otherwise be run in parallel. So-called delimited continuations can remedy, but require special marks that have to be manually inserted in the code for marking the beginning and end of the continuation. In this paper we propose an alternative strategy in which we apply a delimited CPS transformation that operates on a Program Dependence Graph instead to find the limits of each continuation.We implement this strategy in JavaScript and demonstrate its applicability to various web programming scenarios.
Funder
Agentschap voor Innovatie door Wetenschap en Technologie
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference26 articles.
1. Abstract interpretation
2. CPS-transformation after strictness analysis
3. Continuation.js documentation. Continuation.js. https:// github.com/BYVoid/continuation 2013. Continuation.js documentation. Continuation.js. https:// github.com/BYVoid/continuation 2013.