Towards type inference for JavaScript

106Citations
Citations of this article
86Readers
Mendeley users who have this article in their library.
Get full text

Abstract

Object-oriented scripting languages like JavaScript and Python are popular partly because of their dynamic features. These include the runtime modification of objects and classes through addition of fields or updating of methods. These features make static typing difficult and so usually dynamic typing is used. Consequently, errors such as access to non-existent members are not detected until runtime. We first develop a formalism for an object based language, JS0, with features from JavaScript, including dynamic addition of fields and updating of methods. We give an operational semantics and static type system for JSo using structural types. Our types allow objects to evolve in a controlled manner by classifying members as definite or potential. We define a type inference algorithm for JS0 that is sound with respect to the type system. If the type inference algorithm succeeds, then the program is typeable. Therefore, programmers can benefit from the safety offered by the type system, without the need to write explicitly types in their programs. © Springer-Verlag Berlin Heidelberg 2005.

Cite

CITATION STYLE

APA

Anderson, C., Giannini, P., & Drossopoulou, S. (2005). Towards type inference for JavaScript. In Lecture Notes in Computer Science (Vol. 3586, pp. 428–452). Springer Verlag. https://doi.org/10.1007/11531142_19

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free