Go backward to The Nature of Self
Go up to Top
Go forward to Problems with Subtyping
Problems with Method Redefinition
- Typing rules do not hold any more:
- class K1 = record
proc P(X: intexp) = ...;
proc Q = ...call self.P(3) ...
end
class K2 = inherits K1 with record
proc P(X: boolexp) = ...
end
object A: K2
- Invocation call A.Q causes run-time error!
- Redefinition of method with different typing causes problems.
- Typing discipline enforced by subtyping:
- call P(X: NAT) = ...call
X.PLUSTWO ...
- call P(N) is allowed.
- call P(I) should be allowed as well.
Idea: allow subclass whereever superclass is allowed.
Wolfgang.Schreiner@risc.uni-linz.ac.at
Id: qualification.tex,v 1.2 1996/05/02 11:53:49 schreine Exp schreine