Subtyping of Function Types
Solution to method redefinition problem
- Object types:
- N2: rec n.[n/selftype]
{NUM: intloc, EQ: selftype -> boolexp}
- I2: rec i.[i/selftype]
{NUM: intloc, ISNEG: boolloc,
EQ: selftype -> boolexp}
- Resolution of selftype
- n = {NUM: intloc, EQ: n -> boolexp}
- i = {NUM: intloc, ..., EQ: i
-> boolexp}
- i<=n does not imply
i->boolexp<=n->boolexp!
- call Q(I2) is not well-typed!
- Methods that take objects as parameters can destroy subtype relation!
- C++: methods in subclasses must have same argument types.
OO typing systems still topic of research!
Author: Wolfgang Schreiner
Last Modification: May 14, 1998