|
Abstract : |
Over the last several years, much interesting work has been done in modelling object-oriented programming languages in terms of extensions of the bounded second-order lambda calculus, F. Unfortunately, it has recently been shown by Pierce ([Pie92]) that type checking F is undecidable. Moreover, he showed that the undecidability arises in the seemingly simpler problem of determining whether one type is a subtype of another. In [Bru93a, Bru93b], the first author introduced a statically-typed, functional, object-oriented programming language, TOOPL, which supports classes, objects, methods, instance variables, subtypes, and inheritance. The semantics of TOOPL is based on F, so the question arises whether type checking in this language is decidable. In this paper we show that type checking for TOOPLE, a minor variant of TOOPL (Typed Object-Oriented Programming Language), is decidable. The proof proceeds by showing that subtyping is decidable, that all terms of TOOPLE have minimum types (which are in fact computable), and then using these two results to show that type checking is decidable. Our algorithm fails to be polynomial in the size of the term because the size of its type can be exponential in the size of the term. Nevertheless, it performs well in practice., |