Type Inference of Self
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.
KeywordsLanguages and their implementation tools and environments
Unable to display preview. Download preview PDF.
- 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 self.stanford.edu.Google Scholar
- 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.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
- 5.Adele Goldberg and David Robson. Smalltalk-80—The Language and its Implementation. Addison-Wesley, 1983.Google Scholar
- 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.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
- 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
- 12.Michael I. Schwartzbach. Type inference with inequalities. In Proc. TAPSOFT’91, pages 441–455. Springer-Verlag (LNCS 493), 1991.Google Scholar
- 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.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