skip to main content
10.1145/268946.268967acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article
Free Access

Local type inference

Authors Info & Claims
Published:21 January 1998Publication History

ABSTRACT

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.

References

  1. AN91.Shaft Aditya and Rishiyur S. Nikhil. Incremental polymorphism. In Functional Programming Languages and Computer Architecture, number 523 in Lecture Notes in Computer Science. Springer-Verlag, August 1991. Also available as MIT CSG Memo 329, June 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. AW93.Alexander Aiken and Edward L. Wimmers. Type inclusion constraints and type inference. In Gonference on Functional Programming Languages and Computer Architecture, pages 31--41. ACM press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Boe85.Hans-J. Boehm. Partial polymorphic type inference is undecidable. In 26th Annual Symposium on Foundations of. Computer Science, pages 339-345. IEEE, October 1985.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Boe89.Hans-J. Boehm. Type inference in the presence of type abstraction. In Proceedings of the SIG- PLAN "89 Con}erence on Programming Language Design and Implementation, pages 192- 206, Portland, OR, June 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Car91.Luca Cardelli. Typeful programming. In E. J. Neuhold and M. Paul, editors, Formal Description of Programming Concepts. Springer-Verlag, 1991. An earlier version appeared as DEC Systems Research Center Research Report ~45, February 1989.Google ScholarGoogle Scholar
  6. Car93.Luca Cardelli. An implementation of F<. Research report 97, DEC Systems Research Center, February 1993.Google ScholarGoogle Scholar
  7. CG92.Pierre-Louis Curien and Giorgio Ghelli. Coherence of subsumption: Minimum typing and type-checking in F<. Mathematical Structures in Computer Science, 2-.55--91, 1992. Also in Carl A. Gunter and John C. Mitchell, editors, Theoretical Aspects of Object-Oriented Programming: Types, Semantics, and Language Design (MIT Press, 1994). Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. CMMS94.Luca Cardelli, Simone Martini, John C. Mitehell~ and Andre Scedrov. An extension of system F with subtyping. Information and Computation, 109(1-2):4-56, 1994. A preliminary version appeared'in TACS '91 (Sendai, Japan, pp. 750- 770). Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Com94.Adriana B. Compaguoni. Decidability of higherorder subtyping with intersection types. In Computer Science Logic, September 1994. Kazimierz, Poland. Springer Lecture Notes in Computer Science 933, June 1995. Also available as University of Edinburgh, LFCS technical report ECS- LFCS-94-281, titled "Subtyping in F,~ is decidable".Google ScholarGoogle Scholar
  10. CW85.Luca Cardelli and Peter Wegner. On understanding types, data abstraction, and polymorphism. Computing Surveys, 17(4), December 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. DHKP96.Giiles Dowek, Thdrkse Hardin, Claude Kirchner, and l~rank Pfenning. Unification via explicit substitutions: The case of higher-order patterns. In M. Maher, editor, Proceedings of the Joint International Conference and Symposium on Logic Programming, pages 259-273, Bonn, Germany, September 1996. MIT Press.Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. EST95.Jonathan Eifrig, Scott Smith, and Valery Trifonov. Type inference for recursively constrained types and its application to OOP. In Proceedings of the 1995 Mathematical Foundations of Programming Semantics Conference, volume 1 of Electronic Notes in Theoretical Computer Science. Elsevier, 1995.Google ScholarGoogle ScholarCross RefCross Ref
  13. FF97.Cormac Flanagan and Matthias Felhisen. Componential set-based analysis. "ACM SIGPLAN Notices, 32(5):235-248, May 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Gir72.Jean-Yves Girard. Interprgtation fonctionelle et dimination des coupures de l'arithmdtique d'ordre sup.grieur. PhD thesis, Universit4 Paris VII, 1972.Google ScholarGoogle Scholar
  15. GP97.Giorgio Ghelli and Benjamin Pierce. Bounded existentials and minimal typing. Theoretical Computer Science, 1997. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. GR97.Jaques Garrigue and Didier Rdrny. Extending ML with semi:explicit polymorphism. In Martfn Abadi and Takayasu Ito, editors, International Symposium on Theoretical Aspects of Computer Software (TAGS), Sendai, Japan, pages 20-46. Springer-Verlag, September 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Hue75.Gdrard Huet. A unification algorithm for typed " A-calculus. Theoretical Computer Science, 1:27- 57, 1975.Google ScholarGoogle ScholarCross RefCross Ref
  18. JG89.James W. O'Toole Jr. and David K. Gifford. Type reconstruction with first-class polymorphic values. In Proceedinps of the SIGPLAN'89 Conference on Programming Language Design and Implemenfation, Portland, Oregon, pages 207- 217. ACM Press, June 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. JW95.Suresh Jagannathan and Andrew Wright. Effective flow analysis for avoiding run-time checks, in Proceedings of the Second International Static Analysis Symposium, volume 983 of LNCS, pages 207-224. Springer-Verlag, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. LO94.Konstantin Lfiufer and Martin Odersky. Polymorphic type inference and abstract data types. A CM Transactions on Programming Languages and Systems (TOPLAS), 16(5):1411- 1430, September 1994. An earlier version appeared in the Proceedings of the ACM SIGPLAN Workshop on ML and its Applications, 1992, under the title "An Extension of ML with First- Class Abstract Types". Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Mil92.Dale Miller. Unification under a mixed prefix. Journal of Symbolic Computation, 14(4):321- 358, October 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. OL96.Martin Odersky and Konstantin L~.ufer. Putting type annotations to work. In Conference Record of POPL 'gr: the 23rd ACM SIGPLAN. SIGA CT Symposium on Principles of Program. ming Languages, pages 54-67, St. Petersburg, Florida, January 21-24, 1996. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. OW97.Martin Odersky and Philip Wadler. Pizza Into Java: Translating theory into pratt|co. In Principles of Programming Languages (POPL), 1997. A preliminary version appeared as Technical Report, 26/96, University of Karlsruhe, July 1996.Google ScholarGoogle Scholar
  24. Per90.Nigel Perry. The Implementation of Practical Functional Programming Languages. PhD thesis, Imperial College, 1990.Google ScholarGoogle Scholar
  25. Pfe88.Frank Pfenning. Partial polymorphic type inference and higher-order unification. In Proeeedings of the 1988 A GM Conference on Lisp and Functional Programming, Snowbird, Utath pages 153-163. ACM Press, July 1988. Also available as Ergo Report 88-048, School of Computer Science, Carnegie Mellon University, Pittsburgh. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Pfe89.Frank Pfenning. Elf: A language for logic definition and verified morn-programming. In Fourth Annual Symposium on Logic in Computer Science, pages 313-322, Pacific Grove, California, June 1989. IEEE Computer Society Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Pfe93.Frank Pfenning. On the undecidability of partial polymorphic type reconstruction. Fanda. menta lnformaticae~ 19(1,2):185-199, 1993. Preliminary version available as Technical Repor~ CMU-CS-92-105, School of Computer Sclence~ Carnegie Mellon University, January 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Pie97.Benjamin C. Pierce. Bounded quantification with bottom. Technical Report 492, Computer Science Department, Indiana University, t997.Google ScholarGoogle Scholar
  29. PL91.Frank Pfenning and Peter Lee. Metacircularlty in the polymorphic A-calculus. Theoretical Gempurer Science, 89(1):137-159, 21 October 1991, A preliminary version appeared in TAPSOFT "89, Proceedings of the International Joint Conference on Theory and Practice in soSttoarc Development, Barcelona, Spain, pages 345-359, Springer-~erlag LNCS 352~ March 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Pot97.Francois Pottier. Simplifying subtyplng constr~nts. In Proceedings of the Interns. lions! Conference on Functional Programming (ICFP), 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. PS94.Benjamin Pierce and Martin Steffen. Higherorder subtyping. In 1FIP Working Conference on Pro#ramming Concepts, Methods and Calculi (PROCOMET), 1994. Full version in Theorelf. cal Computer Science, eel. 176, no. 1-2, pp. 235- 282, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. PT97a.Benjamin C. Pierce and David N. Turner. Local type argument synthesis with bounded quantification. Technical Report 495, Computer Scivnco Department, Indiana University, 1997.Google ScholarGoogle Scholar
  33. PT97b.Benjamin C. Pierce and David N. "Darner. Local type inference. Technical Report 493, Computer Science Department, Indiana University, 1997.Google ScholarGoogle Scholar
  34. PT97c.Benjamin C. Pierce and David N. Turner. Pier: A programming language based on the plcalculus. Technical Report CSCI 476, Computer Science Department, Indian~ University, 1997. To appear in Proof, Language and InteracLion: Essays in Honour of Robin Milner, Gordon Plotkin, Colin Stirling, and Mads Tofte, editors, MIT Press.Google ScholarGoogle Scholar
  35. Rém89.Didier P~my. TypechecXing records and variants in a natural extension of ML. In Proceedings of the Sizteenth Annual A CM Symposium on Principles of Programming Languages, Austin, pages 242-249. ACM, January 1989. Also in Carl A. Gunter and John C. Mitchell, editors, Theoretical Aspects of Objects-Oriented Programming: Types, Semantics, and Language Design (MIT Press, 1994). Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Rém94.Didier R~my. Programming objects with ML-ART: An extension to ML with abstract and record types. In Masami Hagijra and John C. Mitchell, editors, International Symposium on Theoretical Aspects of Computer Software (TACS), pages 321-346, Sendal, Japan, April 1994. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Rey74.John Reynolds. Towards a theory of type structure. In Proc. Colloque sur la Programmation, pages 408-425, New York, 1974. Springer-Verlag LNCS 19. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. RV97.Didier P~my and J6r6me Vouillon. Objective ML: A simple object-oriented extension of ML. In Conference Record of POPL '97: the 24th A CM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 40--53, Paris, Prance, January 15-17, 1997. ACM Press. Full version to appear in Theory and Practice of ObjecA Systems, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. SOW97.Martin Sulzmann, Martin Odersky, and Martin Wehr. Type inference with constrained types. In Fourth International Workshop on Founda- Lions of Object-Oriented Programming (FOOL 4), January 1997. Full version to appear in Theory and Practice of Object S~stems, 1998.Google ScholarGoogle Scholar
  40. Ste97.Martin Steffen. PhD thesis, Universit,it Erlangen-Nfirnberg, 1997. Forthcoming Ph.D. thesis.Google ScholarGoogle Scholar
  41. TS96.Vaiery "Prifonov and Scott Smith. Subtyping constrained types. In Proce~.dings of the Third International Static Analysis Symposium, volume 1145 of LNGS, pages 349-365. Springer Ver}ag, September 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Wan87.Mitchell Wand. Complete type inference for simple objects. In Proceedings of the IEEE Symposium on Logic in Computer Science, Ithaca, NY, June 1987.Google ScholarGoogle Scholar
  43. Wan88.Mitchell Wand. Corrigendum: Complete type inference for simple objects. In Proceedings of the IEBE Symposium on Logic in Computer Science, 1988.Google ScholarGoogle Scholar
  44. Wan94.Mitchell Wand. Type inference for objects with instance variables and inheritance. In Carl A. Gunter and John C. Mitchell, editors, Theoretical Aspects of Object-Oriented Programming. Types, Semantics, and Language Design, pages 97-120. The MIT Press, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Wel94.J.B. Wells. Typability and type checking in the second-order A-calculus are equivalent and undecidable. In Proceedings of the Ninth Annual IEEE Symposium on Logic in Computer Science (LICS), pages 176-185, 1994.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Local type inference

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in
          • Published in

            cover image ACM Conferences
            POPL '98: Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
            January 1998
            403 pages
            ISBN:0897919793
            DOI:10.1145/268946

            Copyright © 1998 ACM

            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]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 21 January 1998

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • Article

            Acceptance Rates

            POPL '98 Paper Acceptance Rate32of175submissions,18%Overall Acceptance Rate824of4,130submissions,20%

            Upcoming Conference

            POPL '25

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader