Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2047849.2047855acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Polymorphic type inference for scripting languages with object extensions

Published: 24 October 2011 Publication History

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.

References

[1]
M. Abadi and L. Cardelli. A Theory of Objects. Springer-Verlag New York, Inc., Secaucus, NJ, USA, 1996.
[2]
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.
[3]
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.
[4]
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.
[5]
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.
[6]
D. Crockford. JavaScript: The Good Parts. O'Reilly Media, 2008.
[7]
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.
[8]
J. Eifrig, S. Smith, and V. Trifonov. Sound Polymorphic Type Inference for Objects. SIGPLAN Not., 30 (10): 169--184, 1995.
[9]
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.
[10]
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.
[11]
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.
[12]
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.
[13]
S. H. Jensen, A. Møller, and P. Thiemann. Type Analysis for JavaScript. In 16th International Static Analysis Symposium (SAS'09), August 2009.
[14]
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.
[15]
J. Palsberg. Efficient Inference of Object Types. Inf. Comput., 123 (2): 198--209, 1995.
[16]
J. Palsberg and T. Zhao. Type Inference for Record Concatenation and Subtyping. Inf. Comput., 189 (1): 54--86, 2004.
[17]
J. Palsberg, T. Zhao, and T. Jim. Automatic discovery of covariant read-only fields. ACM Trans. Program. Lang. Syst., 27 (1): 126--162, 2005.
[18]
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.
[19]
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.
[20]
M. Salib. Faster than C: Static Type Inference with Starkiller. In in PyCon Proceedings, Washington DC, pages 2--26, 2004.
[21]
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.
[22]
P. Thiemann. Towards a Type System for Analyzing JavaScript Programs. In 14th European Symposium on Programming (ESOP'05), pages 408--422, 2005.
[23]
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.
[24]
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.
[25]
T. Zhao. Type inference for scripting languages with implicit extension. In International Workshop on Foundations of Object-Oriented Languages, 2010.

Cited By

View all

Index Terms

  1. Polymorphic type inference for scripting languages with object extensions

        Recommendations

        Comments

        Information & Contributors

        Information

        Published In

        cover image ACM Conferences
        DLS '11: Proceedings of the 7th symposium on Dynamic languages
        October 2011
        114 pages
        ISBN:9781450309394
        DOI:10.1145/2047849
        • General Chair:
        • Theo D'Hondt
        • cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 47, Issue 2
          DLS '11
          February 2012
          103 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/2168696
          Issue’s Table of Contents
        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

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        Published: 24 October 2011

        Permissions

        Request permissions for this article.

        Check for updates

        Author Tags

        1. dynamic languages
        2. javascript
        3. static types
        4. type inference

        Qualifiers

        • Research-article

        Conference

        SPLASH '11
        Sponsor:

        Acceptance Rates

        Overall Acceptance Rate 32 of 77 submissions, 42%

        Upcoming Conference

        Contributors

        Other Metrics

        Bibliometrics & Citations

        Bibliometrics

        Article Metrics

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

        Other Metrics

        Citations

        Cited By

        View all
        • (2023)What Types Are Needed for Typing Dynamic Objects? A Python-Based Empirical StudyProgramming Languages and Systems10.1007/978-981-99-8311-7_2(24-45)Online publication date: 21-Nov-2023
        • (2017)Analysis of JavaScript ProgramsACM Computing Surveys10.1145/310674150:4(1-34)Online publication date: 25-Aug-2017
        • (2017)JSFoxProceedings of the 39th International Conference on Software Engineering Companion10.1109/ICSE-C.2017.91(256-258)Online publication date: 20-May-2017
        • (2013)Type refinement for static analysis of JavaScriptACM SIGPLAN Notices10.1145/2578856.250817549:2(17-26)Online publication date: 28-Oct-2013
        • (2013)Type refinement for static analysis of JavaScriptProceedings of the 9th symposium on Dynamic languages10.1145/2508168.2508175(17-26)Online publication date: 28-Oct-2013
        • (2012)Dependent types for JavaScriptACM SIGPLAN Notices10.1145/2398857.238465947:10(587-606)Online publication date: 19-Oct-2012
        • (2012)Dependent types for JavaScriptProceedings of the ACM international conference on Object oriented programming systems languages and applications10.1145/2384616.2384659(587-606)Online publication date: 19-Oct-2012
        • (2011)Idealized coinductive type systems for imperative object-oriented programsRAIRO - Theoretical Informatics and Applications10.1051/ita/201100945:1(3-33)Online publication date: 15-Mar-2011

        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