I'd like to try to say this one more time. The entire notion of subtyping is context sensitive. It has nothing to do with inheritance, but everything to do with the environment in which the types are being used and evaluated. My best current stab at describing it properly is here: http://members.aol.com/humansandt/papers/subtyping.htm. (''BrokenLink -- cached copy at http://web.archive.org/web/20030413085922/http://members.aol.com/humansandt/papers/subtyping.htm'') The short of it is that there are at least 4 different execution environments, and LSP makes sense in two of them and not in the other two. The question "Is a square a subtype of a rectangle?" is not even a meaningful question unless you * (a) define the particular operations of the square and the rectangle you are discussing, and * (b) say which of the 4 execution environments you intend for your answer to apply to. There are at least 5 interesting variations on those two questions, just for the square / rectangle problem, and the answers are 'yes', 'yes', 'no', 'no', 'no'. --AlistairCockburn ----- I don't much like subtyping either; I prefer ObservationEquivalence. Alistair notes that given reflection, type/subtype and substitutability relations do not hold, because the "reflecting observer" can draw too many distinctions. Any notion of equivalence or membership in a set really depends on the ``observer'' who is supposed to make the distinctions, attempting to pretend otherwise is awkward. See also ObjectAndEnvironment. --AamodSane ----- I would note that the environment needn't be reflective in an explicit sense. Any OO language has type testing, therefore any subtype can only be considered equivalent (in some sense) to the supertype retrospectively relative to previous usages. Therefore Alistair's assertion holds. This is true of any form of equivalence, like the buddha said, everything is relative, except where it ain't. --RichardHenderson. ---- How about a subtype per valid object state? ''Wouldn't that be rather fragile? Getting type errors when someone changes a circle to an ellipse?'' ---- Perhaps it would be more sensible to push responsibility to the mutator, e.g. you can't change a circle to an ellipse if it is aliased subtyped as such somewhere else. This is a bit like Javas VetoableChangeException built into the type system, possibly using predicate types. --StefanPlantikow. ---- CategoryLanguageTyping | CategoryPolymorphism