Type Inference of Self

Analysis of Objects with Dynamic and Multiple Inheritance
  • Ole Agesen
  • Jens Palsberg
  • Michael I. Schwartzbach
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 707)


We have designed and implemented a type inference algorithm for the full Self language. The algorithm can guarantee the safety and disambiguity of message sends, and provide useful information for browsers and optimizing compilers.

Self features objects with dynamic inheritance. This construct has until now been considered incompatible with type inference because it allows the inheritance graph to change dynamically. Our algorithm handles this by deriving and solving type constraints that simultaneously define supersets of both the possible values of expressions and of the possible inheritance graphs. The apparent circularity is resolved by computing a global fixed-point, in polynomial time.

The algorithm has been implemented and can successfully handle the Self benchmark programs, which exist in the “standard Self world” of more than 40,000 lines of code.


Languages and their implementation tools and environments 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Ole Agesen, Lars Bak, Craig Chambers, Bay-Wei Chang, Urs Hölzle, John Maloney, Randall B. Smith, and David Ungar. The SELF programmer’s reference manual, version 2.0. Technical report, Sun Microsystems, Inc, 2550 Garcia Avenue, Mountain View, CA 94043, USA, 1992. SMLI document 93-0056. Available by anonymous ftp from Scholar
  2. 2.
    Alan H. Borning. Classes versus prototypes in object-oriented languages. In ACM/IEEE Fall Joint Computer Conference, pages 36–40, 1986.Google Scholar
  3. 3.
    Craig Chambers and David Ungar. Making pure object-oriented languages practical. In Proc. OOPSLA’91, ACM SIGPLAN Sixth Annual Conference on Object-Oriented Programming Systems, Languages and Applications, pages 1–15, 1991.Google Scholar
  4. 4.
    Craig Chambers, David Ungar, Bay-Wei Chang, and Urs Hölzle. Parents are Shared Parts of Objects: Inheritance and Encapsulation in Self. In Lisp and Symbolic Computation 4(3), pages 207–222, Kluwer Acadamic Publishers, June 1991.CrossRefGoogle Scholar
  5. 5.
    Adele Goldberg and David Robson. Smalltalk-80—The Language and its Implementation. Addison-Wesley, 1983.Google Scholar
  6. 6.
    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
  7. 7.
    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
  8. 8.
    Henry Lieberman. Using prototypical objects to implement shared behavior in object-oriented systems. In Proc. OOPSLA’86, Object-Oriented Programming Systems, Languages and Applications, pages 214–223. Sigplan Notices, 21(11), November 1986.MathSciNetGoogle Scholar
  9. 9.
    Nicholas Oxhøj, Jens Palsberg, and Michael I. Schwartzbach. Making type inference practical. In Proc. ECOOP’92, Sixth European Conference on Object-Oriented Programming, pages 329–349. Springer-Verlag (LNCS 615), Utrecht, The Nether lands, July 1992.CrossRefGoogle Scholar
  10. 10.
    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, pages 146–161, Phoenix, Arizona, October 1991.Google Scholar
  11. 11.
    Jens Palsberg and Michael I. Schwartzbach. Safety analysis versus type inference for partial types. Information Processing Letters, 43:175–180, 1992.zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Michael I. Schwartzbach. Type inference with inequalities. In Proc. TAPSOFT’91, pages 441–455. Springer-Verlag (LNCS 493), 1991.Google Scholar
  13. 13.
    David Ungar and Randall B. Smith. SELF: The power of simplicity. In Proc. OOPSLA’ 87, Object-Oriented Programming Systems, Languages and Applications, pages 227–241, 1987. Also published in Lisp and Symbolic Computation 4(3), Kluwer Acadamic Publishers, June, 1991.Google Scholar
  14. 14.
    Jan Vitek, R. Nigel Horspool, and James S. Uhl. Compile-time analysis of object-oriented programs. In Proc. CC’92, 4th International Conference on Compiler Construction, Paderborn, Germany, pages 236–250. Springer-Verlag (LNCS 641), 1992.Google Scholar
  15. 15.
    Mitchell Wand. A simple algorithm and proof for type inference. Fundamentae Informaticae, X:115–122, 1987.MathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1993

Authors and Affiliations

  • Ole Agesen
    • 1
  • Jens Palsberg
    • 2
  • Michael I. Schwartzbach
    • 2
  1. 1.Dept. of Computer ScienceStanford UniversityStanfordUSA
  2. 2.Computer Science Dept.Aarhus UniversityÅrhus CDenmark

Personalised recommendations