Local type inference

We study two partial type inference methods for a language combining subtyping and impredicative polymorphism. Both methods are local in the sense that missing annotations are recovered using only information from adjacent nodes in the syntax tree, without long-distance constraints such as unification variables. One method infers type arguments in polymorphic applications using a local constraint solver. The other infers annotations on bound variables in function abstractions by propagating type constraints downward from enclosing application nodes. We motivate our design choices by a statistical analysis of the uses of type inference in a sizable body of existing ML code.

[1]  Hans-J. Boehm Partial polymorphic type inference is undecidable , 1985, 26th Annual Symposium on Foundations of Computer Science (sfcs 1985).

[2]  Frank Pfenning,et al.  Elf: a language for logic definition and verified metaprogramming , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[3]  John C. Reynolds,et al.  Towards a theory of type structure , 1974, Symposium on Programming.

[4]  Frank Pfenning,et al.  On the Undecidability of Partial Polymorphic Type Reconstruction , 1993, Fundam. Informaticae.

[5]  Martin Odersky,et al.  Putting type annotations to work , 1996, POPL '96.

[6]  Luca Cardelli,et al.  Typeful Programming , 1989, Formal Description of Programming Concepts.

[7]  Luca Cardelli,et al.  An Extension of System F with Subtyping , 1991, TACS.

[8]  Benjamin C. Pierce,et al.  Simple type-theoretic foundations for object-oriented programming , 1994, Journal of Functional Programming.

[9]  Martin Odersky,et al.  Polymorphic type inference and abstract data types , 1994, TOPL.

[10]  Martin Odersky,et al.  Making the future safe for the past: adding genericity to the Java programming language , 1998, OOPSLA '98.

[11]  Martin Hofmann,et al.  A unifying type-theoretic framework for objects , 1994, Journal of Functional Programming.

[12]  B. Pierce Bounded Quanti cation with Bottom , 1997 .

[13]  Luca Cardelli An implementation of F , 1993 .

[14]  Martin Odersky,et al.  Type Inference with Constrained Types , 1999, Theory Pract. Object Syst..

[15]  J. B. Wells Typability and type checking in the second-order Λ-calculus are equivalent and undecidable (Preliminary Draft) , 1993 .

[16]  Mitchell Wand,et al.  Complete Type Inference for Simple Objects , 1987, LICS.

[17]  Didier Rémy,et al.  Extending ML with Semi-Explicit Higher-Order Polymorphism , 1997, TACS.

[18]  Didier Rémy,et al.  Programming Objects with ML-ART, an Extension to ML with Abstract and Record Types , 1994, TACS.

[19]  Dale Miller,et al.  Unification Under a Mixed Prefix , 1992, J. Symb. Comput..

[20]  Claude Kirchner,et al.  Unification via Explicit Substitutions: The Case of Higher-Order Patterns , 1996, JICSLP.

[21]  Frank Pfenning,et al.  Partial polymorphic type inference and higher-order unification , 1988, LISP and Functional Programming.

[22]  Adriana B. Compagnoni,et al.  Decidability of Higher-Order Subtyping with Intersection Types , 1994, CSL.

[23]  Benjamin C. Pierce,et al.  Bounded Existentials and Minimal Typing , 1998, Theor. Comput. Sci..

[24]  Scott F. Smith,et al.  Type inference for recursively constrained types and its application to OOP , 1995, MFPS.

[25]  Martin Steffen,et al.  Polarized higher-order subtyping , 1998 .

[26]  B. Pierce,et al.  How Good Is Local Type Inference , 1999 .

[27]  Rishiyur S. Nikhil,et al.  Incremental Polymorphism , 1991, FPCA.

[28]  Benjamin C. Pierce,et al.  Pict: a programming language based on the Pi-Calculus , 2000, Proof, Language, and Interaction.

[29]  Martin Odersky,et al.  Pizza into Java: translating theory into practice , 1997, POPL '97.

[30]  Scott F. Smith,et al.  Subtyping Constrained Types , 1996, SAS.

[31]  Hans-Juergen Boehm Type inference in the presence of type abstraction , 1989, PLDI '89.

[32]  David K. Gifford,et al.  Type reconstruction with first-class polymorphic values , 1989, PLDI '89.

[33]  Suresh Jagannathan,et al.  Effective Flow Analysis for Avoiding Run-Time Checks , 1995, SAS.

[34]  Matthias Felleisen,et al.  Componential set-based analysis , 1997, TOPL.

[35]  M. Wand,et al.  Corrigendum: complete type interference for simple objects , 1988, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[36]  Hans-Juergen Boehm Partial Polymorphic Type Inference Is Undecidable , 1985, FOCS.

[37]  Didier Rémy,et al.  Objective ML: a simple object-oriented extension of ML , 1997, POPL '97.

[38]  Peter Lee,et al.  Metacircularity in the Polymorphic lambda-Calculus , 1991, Theor. Comput. Sci..

[39]  Gérard P. Huet,et al.  A Unification Algorithm for Typed lambda-Calculus , 1975, Theor. Comput. Sci..

[40]  Didier Rémy,et al.  Type checking records and variants in a natural extension of ML , 1989, POPL '89.

[41]  Douglas James Howe Automating reasoning in an implementation of constructive type theory , 1988 .

[42]  Benjamin C. Pierce,et al.  Higher-Order Subtyping , 1994, Theor. Comput. Sci..

[43]  Alexander Aiken,et al.  Type inclusion constraints and type inference , 1993, FPCA '93.

[44]  Luca Cardelli,et al.  On understanding types, data abstraction, and polymorphism , 1985, CSUR.

[45]  Giorgio Ghelli,et al.  Coherence of Subsumption, Minimum Typing and Type-Checking in F<= , 1992, Math. Struct. Comput. Sci..

[46]  J. B. Wells,et al.  Typability and type checking in the second-order /spl lambda/-calculus are equivalent and undecidable , 1994, Proceedings Ninth Annual IEEE Symposium on Logic in Computer Science.

[47]  B. Pierce,et al.  Local Type Argument Synthesis with Bounded Quantification , 1997 .

[48]  Mitchell Wand Type inference for objects with instance variables and inheritance , 1994 .

[49]  François Pottier,et al.  Simplifying subtyping constraints , 1996, ICFP '96.

[50]  Luca Cardelli,et al.  A semantic basis for quest , 1990, Journal of Functional Programming.

[51]  J. Y. Girard,et al.  Interpretation fonctionelle et elimination des coupures dans l'aritmetique d'ordre superieur , 1972 .