'

Weak subtyping and genericity

A. Heberle, W. Löwe, R. Neumann, W. Zimmermann, University of Karlsruhe, Germany

In the past, object-oriented design focused on encapsulation and inheritance as primary concepts. As a consequence, there has been a lot of work in the domain of inheritance and the problems coming up, i.e. with covariant type systems.

Recently, parameterized (generic) classes become more popular in object-oriented design. While the use of genericity in functional languages is well known and delivers no major problems, the situation in object-oriented languages differs: The combination of inheritance with genericity raises problems.

This paper describes the theoretical foundations of designing and using generic classes in object-oriented systems. It discusses the possible relationships between generic subclasses as well as those between specialized instances of one generic class. The ideas presented here use the concept of context dependent subtypes, so-called weak subtypes [20], to define criteria for correctness, well-formedness and substitutability.

We illustrate the problems and concepts using a case study from the domain of compiler construction. The example shows, how genericity can be used to model a parameterized intermediate language and how to refine this language with respect to correctness issues.'