Abstract
This paper presents a polymorphic type inference algorithm for a small subset of JavaScript. The goal is to prevent accessing undefined members of objects. We define a type system that allows explicit extension of objects through add operation and implicit extension through method calls. The type system also permits strong updates and unrestricted extensions to new objects. The type inference algorithm is modular so that each function definition is only analyzed once and larger programs can be checked incrementally.
- M. Abadi and L. Cardelli. A Theory of Objects. Springer-Verlag New York, Inc., Secaucus, NJ, USA, 1996. Google Scholar
Digital Library
- O. Agesen. The Cartesian Product Algorithm: Simple and Precise Type Inference Of Parametric Polymorphism. In Proceedings of the 9th European Conference on Object-Oriented Programming (ECOOP'95), pages 2--26, 1995. Google Scholar
Digital Library
- O. Agesen, J. Palsberg, and M. I. Schwartzbach. Type Inference of SELF. In Proceedings of the 7th European Conference on Object-Oriented Programming (ECOOP'93), pages 247--267, 1993. Google Scholar
Digital Library
- C. Anderson, S. Drossopoulou, and P. Giannini. Towards Type Inference for JavaScript. In 19th European Conference on Object-Oriented Programming (ECOOP'05), pages 428--452, July 2005. Google Scholar
Digital Library
- V. Bono and K. Fisher. An Imperative, First-Order Calculus with Object Extension. In the 12th European Conference on Object-Oriented Programming (ECOOP'98), pages 462--497, 1998. Google Scholar
Digital Library
- D. Crockford. JavaScript: The Good Parts. O'Reilly Media, 2008. Google Scholar
Digital Library
- P. Di Gianantonio, F. Honsell, and L. Liquori. A Lambda Calculus of Objects With Self-Inflicted Extension. In Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'98), pages 166--178, 1998. Google Scholar
Digital Library
- J. Eifrig, S. Smith, and V. Trifonov. Sound Polymorphic Type Inference for Objects. SIGPLAN Not., 30 (10): 169--184, 1995. Google Scholar
Digital Library
- M. Furr, J.-h. D. An, and J. S. Foster. Profile guided static typing for dynamic scripting languages. In Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'09), 2009. Google Scholar
Digital Library
- M. Furr, J.-h. D. An, J. S. Foster, and M. Hicks. Static type inference for Ruby. In Proceedings of the 2009 ACM symposium on Applied Computing (SAC'09), pages 1859--1866, 2009. Google Scholar
Digital Library
- A. Guha, C. Saftoiu, and S. Krishnamurthi. Typing local control and state using flow analysis. In Proceedings of the 20th European conference on Programming languages and systems, pages 256--275, 2011. Google Scholar
Digital Library
- P. Heidegger and P. Thiemann. Recency Types for Analyzing Scripting Languages. In Proceedings of the 24th European Conference on Object-Oriented Programming (ECOOP'10), pages 200--224, 2010. Google Scholar
Digital Library
- S. H. Jensen, A. Møller, and P. Thiemann. Type Analysis for JavaScript. In 16th International Static Analysis Symposium (SAS'09), August 2009. Google Scholar
Digital Library
- N. Oxhøj, J. Palsberg, and M. I. Schwartzbach. Making Type Inference Practical. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'92), pages 329--349, 1992. Google Scholar
Digital Library
- J. Palsberg. Efficient Inference of Object Types. Inf. Comput., 123 (2): 198--209, 1995. Google Scholar
Digital Library
- J. Palsberg and T. Zhao. Type Inference for Record Concatenation and Subtyping. Inf. Comput., 189 (1): 54--86, 2004. Google Scholar
Digital Library
- J. Palsberg, T. Zhao, and T. Jim. Automatic discovery of covariant read-only fields. ACM Trans. Program. Lang. Syst., 27 (1): 126--162, 2005. Google Scholar
Digital Library
- J. Plevyak and A. A. Chien. Precise Concrete Type Inference for Object-Oriented Languages. In Proceedings of the 9th annual conference on Object-oriented programming systems, language, and applications (OOPSLA'94), pages 324--340, 1994. Google Scholar
Digital Library
- G. Richards, S. Lesbrene, B. Burg, and J. Vitek. An Analysis of the Dynamic Behavior of JavaScript Programs. In Proceedings of the ACM Programming Language Design and Implementation Conference (PLDI), June 2010. Google Scholar
Digital Library
- M. Salib. Faster than C: Static Type Inference with Starkiller. In in PyCon Proceedings, Washington DC, pages 2--26, 2004.Google Scholar
- S. A. Spoon and O. Shivers. Demand-Driven Type Inference with Subgoal Pruning: Trading Precision for Scalability. In Proceedings of the 18th European Conference on Object-Oriented Programming, (ECOOP'04), pages 51--74, 2004.Google Scholar
Cross Ref
- P. Thiemann. Towards a Type System for Analyzing JavaScript Programs. In 14th European Symposium on Programming (ESOP'05), pages 408--422, 2005. Google Scholar
Digital Library
- S. Tobin-Hochstadt and M. Felleisen. The design and implementation of typed scheme. In Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '08, pages 395--406, 2008. Google Scholar
Digital Library
- T. Wang and S. F. Smith. Precise Constraint-Based Type Inference for Java. In Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP'01), pages 99--117, 2001. Google Scholar
Digital Library
- T. Zhao. Type inference for scripting languages with implicit extension. In International Workshop on Foundations of Object-Oriented Languages, 2010.Google Scholar
Index Terms
Polymorphic type inference for scripting languages with object extensions
Recommendations
Polymorphic type inference for scripting languages with object extensions
DLS '11: Proceedings of the 7th symposium on Dynamic languagesThis paper presents a polymorphic type inference algorithm for a small subset of JavaScript. The goal is to prevent accessing undefined members of objects. We define a type system that allows explicit extension of objects through add operation and ...
Polymorphic type inference and abstract data types
Many statically typed programming languages provide an abstract data type construct, such as the module in Modula-2. However, in most of these languages, implementations of abstract data types are not first-class values. Thus, they cannot be assigned to ...
Type checking and inference for polymorphic and existential types
CATS '09: Proceedings of the Fifteenth Australasian Symposium on Computing: The Australasian Theory - Volume 94This paper proves undecidability of type checking and type inference problems in some variants of typed lambda calculi with polymorphic and existential types. First, type inference in the domain-free polymorphic lambda calculus is proved to be ...







Comments