Lifting the curse of stringly-typed code

Department of Computing Science, University of Alberta, Edmonton, Alberta, Canada
DOI
10.7287/peerj.preprints.2723v1
Subject Areas
Programming Languages, Software Engineering
Keywords
stringly-typed, javascript, linting, static analysis, program analysis, string literal
Copyright
© 2017 Santos et al.
Licence
This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, reproduction and adaptation in any medium and for any purpose provided that it is properly attributed. For attribution, the original author(s), title, publication source (PeerJ Preprints) and either DOI or URL of the article must be cited.
Cite this article
Santos EA, Ali K. 2017. Lifting the curse of stringly-typed code. PeerJ Preprints 5:e2723v1

Abstract

How often do JavaScript programmers embed structured languages into strings literals? We conduct an empirical investigating mining nearly 500 thousand JavaScript source files from almost ten thousand repositories from GitHub. We parsed each string literal with seven separate common grammars, and found the most common data type that is hidden within the confines of string literals. To reduce the overuse of strings for structured data types, we present a simple static program analyzer that finds embedded languages and warns the developer, providing an optional fix.

Author Comment

This is a preprint submission to PeerJ Preprints.