skip to main content
10.1145/2577080.2577088acmotherconferencesArticle/Chapter ViewAbstractPublication PagesmodularityConference Proceedingsconference-collections
research-article

JavaScript module system: exploring the design space

Published: 22 April 2014 Publication History

Abstract

While JavaScript is one of the most widely used programming languages not only for web applications but also for large projects, it does not provide a language-level module system. JavaScript developers have used the module pattern to avoid name conflicts by themselves, but the prevalent uses of multiple libraries and even multiple versions of a single library in one application complicate maintenance of namespace. The next release of the JavaScript language specification will support a module system, but the module proposal in prose does not clearly describe its semantics. Several tools attempt to support the new features in the next release of JavaScript by translating them into the current JavaScript, but their module semantics do not faithfully implement the proposal.
In this paper, we identify some of the design issues in the JavaScript module system. We describe ambiguous or undefined semantics of the module system with concrete examples, show how the existing tools support them in a crude way, and discuss reasonable choices for the design issues. We specify the formal semantics of the module system, which provides unambiguous description of the design choices, and we provide its implementation as a source-to-source transformation from JavaScript with modules to the plain JavaScript that the current JavaScript engines can evaluate.

References

[1]
Junhee Cho and Sukyoung Ryu. JavaScript module system: Exploring the design space (extended with proofs). http://plrg.kaist.ac.kr/research/publications.
[2]
ECMA. Harmony proposals. http://wiki.ecmascript.org/doku.php?id=harmony:proposals.
[3]
ECMA. Harmony proposals -- draft specification for ES.next (Ecma-262 Edition 6). http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts.
[4]
ECMA. ECMA-262: ECMAScript language specification. 5th edition, December 2009.
[5]
Linux Foundation. Tizen: an open source, standards-based software platform for multiple device categories. https://www.tizen.org.
[6]
Google. Traceur-compiler: Google's vehicle for JavaScript language design experimentation. https://code.google.com/p/traceur-compiler/.
[7]
Robert Grimm. Rats! -- an easily extensible parser generator. http://cs.nyu.edu/~rgrimm/xtc/rats.html.
[8]
Salvatore Guarnieri, Marco Pistoia, Omer Tripp, Julian Dolby, Stephen Teilhet, and Ryan Berg. Saving the world wide web from vulnerable JavaScript. In Proceedings of the 20th Internaional Symposium on Software Testing and Analysis, 2011.
[9]
Arjun Guha, Claudiu Saftoiu, and Shriram Krishnamurthi. The essence of JavaScript. In Proceedings of the 24th European Conference on Object-Oriented Programming, 2010.
[10]
Dave Herman and Sam Tobin-Hochstadt. Harmony proposals -- modules. http://wiki.ecmascript.org/doku.php?id=harmony:modules.
[11]
Alexa Internet. Alexa. http://www.alexa.com.
[12]
Joynet. Node.js. http://nodejs.org/.
[13]
jQuery Foundation. jQuery. http://jquery.com/.
[14]
jQuery Foundation. jQuery.noConflict(). http://api.jquery.com/jQuery.noConflict/.
[15]
PLRG @ KAIST. SAFE: Scalable Analysis Framework for ECMAScript. http://safe.kaist.ac.kr.
[16]
Seonghoon Kang and Sukyoung Ryu. Formal specification of a JavaScript module system. In Proceedings of the 2012 ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, 2012.
[17]
Hongki Lee, Sooncheol Won, Joonho Jin, Junhee Cho, and Sukyoung Ryu. SAFE: Formal specification and implementation of a scalable analysis framework for ECMAScript. In Proceedings of the 19th International Workshop on Foundations of Object-Oriented Languages, 2012.
[18]
Microsoft. TypeScript. http://www.typescriptlang.org.
[19]
Eric Miraglia. A JavaScript module pattern. http://www.yuiblog.com/blog/2007/06/12/module-pattern/.
[20]
Changhee Park, Hongki Lee, and Sukyoung Ryu. All about the with statement in JavaScript: Removing with statements in JavaScript applications. In Proceedings of the Dynamic Language Symposium 2013, 2013.
[21]
Samsung Electronics. Samsung Smart TV. http://developer.samsung.com/smarttv.
[22]
Brian R. Stoler, Eric Allen, and Dan Smith. ASTGen. http://sourceforge.net/projects/astgen.
[23]
Prototype Core Team. Prototype. http://prototypejs.org/.
[24]
The MooTools Dev Team. MooTools: a compact JavaScript framework. http://mootools.net.
[25]
W3C. Document Object Model (DOM). http://www.w3.org/DOM/.
[26]
W3C. Web IDL. http://www.w3.org/TR/WebIDL.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
MODULARITY '14: Proceedings of the 13th international conference on Modularity
April 2014
264 pages
ISBN:9781450327725
DOI:10.1145/2577080
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

  • AOSA: Aspect-Oriented Software Association

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 22 April 2014

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. javascript
  2. module system
  3. source-to-source transformation

Qualifiers

  • Research-article

Funding Sources

Conference

MODULARITY '14
Sponsor:
  • AOSA

Acceptance Rates

MODULARITY '14 Paper Acceptance Rate 21 of 60 submissions, 35%;
Overall Acceptance Rate 41 of 139 submissions, 29%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)9
  • Downloads (Last 6 weeks)2
Reflects downloads up to 13 Jan 2025

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media