Sync/CC: Continuations and aspects to tame callback dependencies on JavaScript handlers

Paul Leger, Hiroaki Fukuda

Research output: ResearchConference contribution

Abstract

In JavaScript handlers, callbacks are widely used to develop rich responsive and interactive Web applications. However, the dependency among nested callbacks, known as callback hell, can make it difficult to understand and maintain them, which will eventually mix concerns. Unfortunately, current solutions for JavaScript do not fully address the aforementioned issue. This paper presents Sync/cc, a JavaScript library that uses continuations and aspects to allow developers to write handlers that need nested callbacks in a synchronous style, preventing callback dependencies. Unlike current solutions, Sync/cc is modular, customizable, and succinct because it does not require special and scattered keywords, code refactoring, or adding ad-hoc implementations like state machines. In practice, our proposal uses a) continuations to only suspend the current handler execution until the asynchronous operation is resolved, and b) aspects to apply continuations in a non-intrusive way.

LanguageEnglish
Title of host publication32nd Annual ACM Symposium on Applied Computing, SAC 2017
PublisherAssociation for Computing Machinery
Pages1245-1250
Number of pages6
VolumePart F128005
ISBN (Electronic)9781450344869
DOIs
StatePublished - 2017 Apr 3
Event32nd Annual ACM Symposium on Applied Computing, SAC 2017 - Marrakesh, Morocco
Duration: 2017 Apr 42017 Apr 6

Other

Other32nd Annual ACM Symposium on Applied Computing, SAC 2017
CountryMorocco
CityMarrakesh
Period17/4/417/4/6

Keywords

  • Aspect-oriented programming
  • AspectScript
  • Callback dependencies
  • Continuations
  • JavaScript
  • Sync/cc
  • Web applications

ASJC Scopus subject areas

  • Software

Cite this

Leger, P., & Fukuda, H. (2017). Sync/CC: Continuations and aspects to tame callback dependencies on JavaScript handlers. In 32nd Annual ACM Symposium on Applied Computing, SAC 2017 (Vol. Part F128005, pp. 1245-1250). Association for Computing Machinery. DOI: 10.1145/3019612.3019783

Sync/CC : Continuations and aspects to tame callback dependencies on JavaScript handlers. / Leger, Paul; Fukuda, Hiroaki.

32nd Annual ACM Symposium on Applied Computing, SAC 2017. Vol. Part F128005 Association for Computing Machinery, 2017. p. 1245-1250.

Research output: ResearchConference contribution

Leger, P & Fukuda, H 2017, Sync/CC: Continuations and aspects to tame callback dependencies on JavaScript handlers. in 32nd Annual ACM Symposium on Applied Computing, SAC 2017. vol. Part F128005, Association for Computing Machinery, pp. 1245-1250, 32nd Annual ACM Symposium on Applied Computing, SAC 2017, Marrakesh, Morocco, 17/4/4. DOI: 10.1145/3019612.3019783
Leger P, Fukuda H. Sync/CC: Continuations and aspects to tame callback dependencies on JavaScript handlers. In 32nd Annual ACM Symposium on Applied Computing, SAC 2017. Vol. Part F128005. Association for Computing Machinery. 2017. p. 1245-1250. Available from, DOI: 10.1145/3019612.3019783
Leger, Paul ; Fukuda, Hiroaki. / Sync/CC : Continuations and aspects to tame callback dependencies on JavaScript handlers. 32nd Annual ACM Symposium on Applied Computing, SAC 2017. Vol. Part F128005 Association for Computing Machinery, 2017. pp. 1245-1250
@inbook{742ba20634ab4a7e84322264b828198e,
title = "Sync/CC: Continuations and aspects to tame callback dependencies on JavaScript handlers",
abstract = "In JavaScript handlers, callbacks are widely used to develop rich responsive and interactive Web applications. However, the dependency among nested callbacks, known as callback hell, can make it difficult to understand and maintain them, which will eventually mix concerns. Unfortunately, current solutions for JavaScript do not fully address the aforementioned issue. This paper presents Sync/cc, a JavaScript library that uses continuations and aspects to allow developers to write handlers that need nested callbacks in a synchronous style, preventing callback dependencies. Unlike current solutions, Sync/cc is modular, customizable, and succinct because it does not require special and scattered keywords, code refactoring, or adding ad-hoc implementations like state machines. In practice, our proposal uses a) continuations to only suspend the current handler execution until the asynchronous operation is resolved, and b) aspects to apply continuations in a non-intrusive way.",
keywords = "Aspect-oriented programming, AspectScript, Callback dependencies, Continuations, JavaScript, Sync/cc, Web applications",
author = "Paul Leger and Hiroaki Fukuda",
year = "2017",
month = "4",
doi = "10.1145/3019612.3019783",
volume = "Part F128005",
pages = "1245--1250",
booktitle = "32nd Annual ACM Symposium on Applied Computing, SAC 2017",
publisher = "Association for Computing Machinery",

}

TY - CHAP

T1 - Sync/CC

T2 - Continuations and aspects to tame callback dependencies on JavaScript handlers

AU - Leger,Paul

AU - Fukuda,Hiroaki

PY - 2017/4/3

Y1 - 2017/4/3

N2 - In JavaScript handlers, callbacks are widely used to develop rich responsive and interactive Web applications. However, the dependency among nested callbacks, known as callback hell, can make it difficult to understand and maintain them, which will eventually mix concerns. Unfortunately, current solutions for JavaScript do not fully address the aforementioned issue. This paper presents Sync/cc, a JavaScript library that uses continuations and aspects to allow developers to write handlers that need nested callbacks in a synchronous style, preventing callback dependencies. Unlike current solutions, Sync/cc is modular, customizable, and succinct because it does not require special and scattered keywords, code refactoring, or adding ad-hoc implementations like state machines. In practice, our proposal uses a) continuations to only suspend the current handler execution until the asynchronous operation is resolved, and b) aspects to apply continuations in a non-intrusive way.

AB - In JavaScript handlers, callbacks are widely used to develop rich responsive and interactive Web applications. However, the dependency among nested callbacks, known as callback hell, can make it difficult to understand and maintain them, which will eventually mix concerns. Unfortunately, current solutions for JavaScript do not fully address the aforementioned issue. This paper presents Sync/cc, a JavaScript library that uses continuations and aspects to allow developers to write handlers that need nested callbacks in a synchronous style, preventing callback dependencies. Unlike current solutions, Sync/cc is modular, customizable, and succinct because it does not require special and scattered keywords, code refactoring, or adding ad-hoc implementations like state machines. In practice, our proposal uses a) continuations to only suspend the current handler execution until the asynchronous operation is resolved, and b) aspects to apply continuations in a non-intrusive way.

KW - Aspect-oriented programming

KW - AspectScript

KW - Callback dependencies

KW - Continuations

KW - JavaScript

KW - Sync/cc

KW - Web applications

UR - http://www.scopus.com/inward/record.url?scp=85020867693&partnerID=8YFLogxK

UR - http://www.scopus.com/inward/citedby.url?scp=85020867693&partnerID=8YFLogxK

U2 - 10.1145/3019612.3019783

DO - 10.1145/3019612.3019783

M3 - Conference contribution

VL - Part F128005

SP - 1245

EP - 1250

BT - 32nd Annual ACM Symposium on Applied Computing, SAC 2017

PB - Association for Computing Machinery

ER -