Problems with Method Redefinition
- Typing rules do not hold any more:
- class K1 = record
proc P(X: intexp) = ...;
proc Q = ...call self.P(3) ...
class K2 = inherits K1 with record
proc P(X: boolexp) = ...
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
- call P(N) is allowed.
- call P(I) should be allowed as well.
Idea: allow subclass whereever superclass is allowed.
Author: Wolfgang Schreiner
Last Modification: May 14, 1998