Abstract
We de ne a specialization inheritance mechanism for object-oriented programming, admitting covariant rede nition of both methods and instance variables in subclassing. We investigate on the semantic weakness that makes such very flexible inheritance infeasible for a statically type-checked programming language supporting polymorphic assignment and polymorphic method invocation.
We show that the source of troubles is not in the covariant rede nition of methods, and present a suitable multiple dispatch mechanism. This multiple dispatch uses static type information in order to drive the execution of method invocations. Moreover it exploits the notion of method linearization (that we de ne in the paper) at both compile-time and run-time.
The covariant rede nition of instance variables can be the source of runtime type errors in polymorphic instructions, when the update problem occurs. We devise a general mechanism to recover from the update problem. In order to be allowed to rede ne covariantly class instance variables and use them in programs with polymorphism, the programmer is requested to de ne suitable default-value methods, able to produce a value for an instance variable starting from an actual value of the same instance variable in a superclass.