Object-oriented type inference
- 1 November 1991
- journal article
- Published by Association for Computing Machinery (ACM) in ACM SIGPLAN Notices
- Vol. 26 (11) , 146-161
- https://doi.org/10.1145/118014.117965
Abstract
We present a new approach to inferring types in un- typed object-oriented programs with inheritance, assignments, and late binding. It guarantees that all messages are understood, annotates the pro- gram with type information, allows polymorphic methods, and can be used as the basis of an op- timizing compiler. Types are finite sets of classes and subtyping is set inclusion. Using a trace graph, our algorithm constructs a set of conditional type constraints and computes the least solution by least fixed-point derivation. The algorithm guarantees that all messages are un- derstood, annotates the program with type infor- mation, allows polymorphic methods, and can be used as the basis of an optimizing compiler. Types are finite sets of classes and subtyping is set in- clusion. Given a concrete program, the algorithm constructs a finite graph of type constraints. The program is typuble if these constraints are solvable. The algorithm then computes the least solution in worst-case exponential time. The graph contains all type information that can be derived from the program without keeping track of nil values or flow analyzing the contents of instance variables. This makes the algorithm capable of checking most com- mon programs; in particular, it allows for polymor- phic methods. The algorithm is similar to previousKeywords
This publication has 15 references indexed in Scilit:
- Type checking records and variants in a natural extension of MLPublished by Association for Computing Machinery (ACM) ,1989
- Type theories and object-oriented programmimgACM Computing Surveys, 1988
- Inheritance in smalltalk-80: a denotational definitionPublished by Association for Computing Machinery (ACM) ,1988
- Objects as closures: abstract semantics of object-oriented languagesPublished by Association for Computing Machinery (ACM) ,1988
- Type-checking SmalltalkPublished by Association for Computing Machinery (ACM) ,1986
- On understanding types, data abstraction, and polymorphismACM Computing Surveys, 1985
- Declaration-free type checkingPublished by Association for Computing Machinery (ACM) ,1985
- A type declaration and inference system for smalltalkPublished by Association for Computing Machinery (ACM) ,1982
- Inferring types in SmalltalkPublished by Association for Computing Machinery (ACM) ,1981
- A general scheme for the automatic inference of variable typesPublished by Association for Computing Machinery (ACM) ,1978