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

Paul Leger, Hiroaki Fukuda

Research output: Chapter in Book/Report/Conference proceedingConference contribution

4 Citations (Scopus)

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.

Original 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
Publication statusPublished - 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
Country/TerritoryMorocco
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