ABSTRACT
We present Dependent JavaScript (DJS), a statically typed dialect of the imperative, object-oriented, dynamic language. DJS supports the particularly challenging features such as run-time type-tests, higher-order functions, extensible objects, prototype inheritance, and arrays through a combination of nested refinement types, strong updates to the heap, and heap unrolling to precisely track prototype hierarchies. With our implementation of DJS, we demonstrate that the type system is expressive enough to reason about a variety of tricky idioms found in small examples drawn from several sources, including the popular book JavaScript: The Good Parts and the SunSpider benchmark suite.
- M. Abadi and L. Cardelli. A Theory of Objects. Springer-Verlag, 1996. Google ScholarDigital Library
- A. Ahmed, M. Fluet, and G. Morrisett. L3: A Linear Language with Locations. Fundamenta Informaticae, 77(4), June 2007. Google ScholarDigital Library
- A. Aiken, J. Kodumal, J. S. Foster, and T. Terauchi. Checking and Inferring Local Non-Aliasing. In PLDI, 2003. Google ScholarDigital Library
- C. Anderson, S. Drossopoulou, and P. Giannini. Towards Type Inference for JavaScript. In ECOOP, 2005. Google ScholarDigital Library
- G. M. Bierman, A. D. Gordon, C. Hritcu, and D. E. Langworthy. Semantic Subtyping with an SMT Solver. In ICFP, 2010. Google ScholarDigital Library
- V. Bono and K. Fisher. An Imperative, First-Order Calculus with Object Extension. In ECOOP, 1998. Google ScholarDigital Library
- R. Chugh, D. Herman, and R. Jhala. Dependent Types for JavaScript -- Appendix. arxiv.org/abs/1112.4106.Google Scholar
- R. Chugh, J. A. Meister, R. Jhala, and S. Lerner. Staged Information Flow for JavaScript. In Proceedings of PLDI 2009, pages 50--62, 2009. Google ScholarDigital Library
- R. Chugh, P. M. Rondon, and R. Jhala. Nested Refinements: A Logic for Duck Typing. In POPL, 2012. Google ScholarDigital Library
- D. Crockford. JavaScript: The Good Parts. Yahoo! Press, 2008. Google ScholarDigital Library
- L. de Moura and N. Bjørner. Z3: An Efficient SMT solver. In TACAS, 2008. Google ScholarDigital Library
- R. DeLine and M. Fahndrich. Enforcing High-level Protocols in Low-level Software. In PLDI, 2001. Google ScholarDigital Library
- ECMA. TC-39 Committee. www.ecmascript.org/community.php.Google Scholar
- M. Fahndrich and R. DeLine. Adoption and Focus: Practical Linear Types for Imperative Programming. In PLDI, 2002. Google ScholarDigital Library
- J. Foster, T. Terauchi, and A. Aiken. Flow-sensitive Type Qualifiers. In PLDI, 2002. Google ScholarDigital Library
- M. Furr, J. hoon (David) An, J. S. Foster, and M. W. Hicks. Static type inference for ruby. In SAC, 2009. Google ScholarDigital Library
- P. Gardner, S. Maffeis, and G. D. Smith. Towards a Program Logic for JavaScript. In POPL, 2012. Google ScholarDigital Library
- P. D. Gianantonio, F. Honsell, and L. Liquori. A Lambda Calculus of Objects with Self-Inflicted Extension. In OOPSLA, 1998. Google ScholarDigital Library
- Google. Closure library. https://developers.google.com/closure/library.Google Scholar
- Google. V8 benchmark. http://v8.googlecode.com/svn/data/benchmarks/.Google Scholar
- A. Guha, C. Saftoiu, and S. Krishnamurthi. The Essence of JavaScript. In ECOOP, 2010. Google ScholarDigital Library
- A. Guha, C. Softoiu, and S. Krishnamurthi. Typing Local Control and State Using Flow Analysis. In ESOP, 2011. Google ScholarDigital Library
- P. Heidegger and P. Thiemann. Recency Types for Analyzing Scripting Languages. In ECOOP, 2010. Google ScholarDigital Library
- E. International. ECMAScript Language Specification, ECMA-262, 3rd ed. 1999.Google Scholar
- K. W. Knowles and C. Flanagan. Compositional Reasoning and Decidable Checking for Dependent Contract Types. In PLPV, 2009. Google ScholarDigital Library
- S. Maffeis, J. Mitchell, and A. Taly. An operational semantics for JavaScript. In APLAS, 2008. Google ScholarDigital Library
- J. McCarthy. Towards a Mathematical Science of Computation. In IFIP, 1962.Google Scholar
- B. C. Pierce. Types and Programming Languages. 2002. Google ScholarDigital Library
- B. C. Pierce and D. N. Turner. Local Type Inference. In POPL, 1998. Google ScholarDigital Library
- J. G. Politz, S. A. Eliopoulos, A. Guha, and S. Krishnamurthi. Adsafety: Type-based Verification of JavaScript Sandboxing. In USENIX Security, 2011. Google ScholarDigital Library
- P. Rondon, M. Kawaguchi, and R. Jhala. Low-Level Liquid Types. In POPL, 2010. Google ScholarDigital Library
- F. Smith, D. Walker, and G. Morrisett. Alias Types. In ESOP, 2000. Google ScholarDigital Library
- J. Sunshine, K. Naden, S. Stork, J. Aldrich, and E. Tanter. First-class State Change in Plaid. In OOPSLA, 2011. Google ScholarDigital Library
- SunSpider. Javascript benchmark. http://www.webkit.org/perf/sunspider/sunspider.html.Google Scholar
- P. Thiemann. Towards a Type System for Analyzing JavaScript Programs. In ESOP, 2005. Google ScholarDigital Library
- S. Tobin-Hochstadt and M. Felleisen. Logical Types for Untyped Languages. In ICFP, 2010. Google ScholarDigital Library
- D. Walker and G. Morrisett. Alias Types for Recursive Data Structures. In TIC. 2000. Google ScholarDigital Library
- S. yu Guo and B. Hackett. Fast and Precise Hybrid Type Inference for JavaScript. In PLDI, 2012. Google ScholarDigital Library
- T. Zhao. Polymorphic Type Inference for Scripting Languages with Object Extensions. In DLS, 2011. Google ScholarDigital Library
Index Terms
- Dependent types for JavaScript
Recommendations
Dependent types for JavaScript
OOPSLA '12We present Dependent JavaScript (DJS), a statically typed dialect of the imperative, object-oriented, dynamic language. DJS supports the particularly challenging features such as run-time type-tests, higher-order functions, extensible objects, prototype ...
Fully abstract compilation to JavaScript
POPL '13Many tools allow programmers to develop applications in high-level languages and deploy them in web browsers via compilation to JavaScript. While practical and widely used, these compilers are ad hoc: no guarantee is provided on their correctness for ...
Type inference for static compilation of JavaScript
OOPSLA 2016: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsWe present a type system and inference algorithm for a rich subset of JavaScript equipped with objects, structural subtyping, prototype inheritance, and first-class methods. The type system supports abstract and recursive objects, and is expressive ...
Comments