Skip to main content

Making type inference practical

  • Conference paper
  • First Online:
ECOOP ’92 European Conference on Object-Oriented Programming (ECOOP 1992)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 615))

Included in the following conference series:

Abstract

We present the implementation of a type inference algorithm for untyped object-oriented programs with inheritance, assignments, and late binding. The algorithm significantly improves our previous one, presented at OOPSLA'91, since it can handle collection classes, such as List, in a useful way. Abo, the complexity has been dramatically improved, from exponential time to low polynomial time. The implementation uses the techniques of incremental graph construction and constraint template instantiation to avoid representing intermediate results, doing superfluous work, and recomputing type information. Experiments indicate that the implementation type checks as much as 100 lines pr. second. This results in a mature product, on which a number of tools can be based, for example a safety tool, an image compression tool, a code optimization tool, and an annotation tool. This may make type inference for object-oriented languages practical.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Alan H. Borning and Daniel H. H. Ingalls. A type declaration and inference system for Smalltalk. In Ninth Symposium on Principles of Programming Languages, pages 133–141. ACM Press, January 1982.

    Google Scholar 

  2. Luca Cardelli. A semantics of multiple inheritance. In Gilles Kahn, David Mac-Queen, and Gordon Plotkin, editors, Semantics of Data Types, pages 51–68. Springer-Verlag (LNCS 173), 1984.

    Google Scholar 

  3. Luca Cardelli and Peter Wegner. On understanding types, data abstraction, and polymorphism. ACM Computing Surveys, 17(4):471–522, December 1985.

    Article  Google Scholar 

  4. William Cook and Jens Palsberg. A denotational semantics of inheritance and its correctness. In Proc. OOPSLA'89, ACM SIGPLAN Fourth Annual Conference on Object-Oriented Programming Systems, Languages and Applications, 1989. To appear in Information and Computation.

    Google Scholar 

  5. William R. Cook. A Denotational Semantics of Inheritance. PhD thesis, Brown University, 1989.

    Google Scholar 

  6. Ole-Johan Dahl, BjØrn Myhrhaug, and Kristen Nygaard. Simula 67 common base language. Technical report, Norwegian Computing Center, Oslo, Norway, 1968.

    Google Scholar 

  7. Scott Danforth and Chris Tomlinson. Type theories and object-oriented programming. ACM Computing Surveys, 20(1), March 1988.

    Google Scholar 

  8. Adele Goldberg and David Robson. Smalltalk-80—The Language and its Implementation. Addison-Wesley, 1983.

    Google Scholar 

  9. Justin O. Graver and Ralph E. Johnson. A type system for Smalltalk. In Seventeenth Symposium on Principles of Programming Languages, pages 136–150. ACM Press, January 1990.

    Google Scholar 

  10. Justin Owen Graver. Type-Checking and Type-Inference for Object-Oriented Programming Languages. PhD thesis, Department of Computer Science, University of Illinois at Urbana-Champaign, August 1989. UIUCD-R-89-1539.

    Google Scholar 

  11. Andreas V. Hense. Polymorphic type inference for a simple object oriented programming language with state. Technical Report No. A 20/90, Fachbericht 14, UniversitÄt des Saarlandes, December 1990.

    Google Scholar 

  12. Andreas V. Hense. Wrapper semantics of an object-oriented programming language with state. In T. Ito and A. R. Meyer, editors, Proc. Theoretical Aspects of Computer Software, pages 548–568. Springer-Verlag (LNCS 526), 1991.

    Google Scholar 

  13. Urs Hölzle, Craig Chambers, and David Ungar. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In Proc. ECOOP'91, Fifth European Conference on Object-Oriented Programming, 1991.

    Google Scholar 

  14. Samuel Kamin. Inheritance in Smalltalk-80: A denotational definition. In Fifteenth Symposium on Principles of Programming Languages, pages 80–87. ACM Press, January 1988.

    Google Scholar 

  15. Bent B. Kristensen, Ole Lehrmann Madsen, Birger MØller-Pedersen, and Kristen Nygaard. The BETA programming language. In Bruce Shriver and Peter Wegner, editors, Research Directions in Object-Oriented Programming, pages 7–48. MIT Press, 1987.

    Google Scholar 

  16. Bertrand Meyer. Object-Oriented Software Construction. Prentice-Hall, Englewood Cliffs, NJ, 1988.

    Google Scholar 

  17. Nicholas OxhØj, Jens Palsberg, and Michael I. Schwartzbach. Making type inference practical. Technical Report DAIMI PB-385, Computer Science Department, Aarhus University, 1992.

    Google Scholar 

  18. Jens Palsberg and Michael I. Schwartzbach. Object-oriented type inference. In Proc. OOPSLA'91, ACM SIGPLAN Sixth Annual Conference on Object-Oriented Programming Systems, Languages and Applications, 1991.

    Google Scholar 

  19. Jens Palsberg and Michael I. Schwartzbach. Static typing for object-oriented programming. Computer Science Department, Aarhus University. PB-355. Submitted for publication, 1991.

    Google Scholar 

  20. Jens Palsberg and Michael I. Schwartzbach. What is type-safe code reuse? In Proc. ECOOP'91, Fifth European Conference on Object-Oriented Programming. Springer-Verlag (LNCS 512), 1991.

    Google Scholar 

  21. Uday S. Reddy. Objects as closures: Abstract semantics of object-oriented languages. In Proc. ACM Conference on Lisp and Functional Programming, pages 289–297. ACM, 1988.

    Google Scholar 

  22. Didier Rémy. Typechecking records and variants in a natural extension of ML. In Sixteenth Symposium on Principles of Programming Languages, pages 77–88. ACM Press, January 1989.

    Google Scholar 

  23. Michael I. Schwartzbach. Type inference with inequalities. In Proc. TAPSOFT'91. Springer-Verlag (LNCS 493), 1991.

    Google Scholar 

  24. Bjarne Stroustrup. The C++ Programming Language. Addison-Wesley, 1986.

    Google Scholar 

  25. Norihisa Suzuki. Inferring types in Smalltalk. In Eighth Symposium on Principles of Programming Languages, pages 187–199. ACM Press, January 1981.

    Google Scholar 

  26. Mitchell Wand. A simple algorithm and proof for type inference. Fundamentae Informaticae, X:115–122, 1987.

    MathSciNet  Google Scholar 

  27. Mitchell Wand. Type inference for record concatenation and multiple inheritance. In LICS'89, Fourth Annual Symposium on Logic in Computer Science, pages 92–97, 1989.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Ole Lehrmann Madsen

Rights and permissions

Reprints and permissions

Copyright information

© 1992 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Oxhøj, N., Palsberg, J., Schwartzbach, M.I. (1992). Making type inference practical. In: Madsen, O.L. (eds) ECOOP ’92 European Conference on Object-Oriented Programming. ECOOP 1992. Lecture Notes in Computer Science, vol 615. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0053045

Download citation

  • DOI: https://doi.org/10.1007/BFb0053045

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-55668-8

  • Online ISBN: 978-3-540-47268-1

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics