Corollary: "class hierarchies" become "class dynasties".https://twitter.com/propensive/status/1244903422643572736 …
-
-
Replying to @propensive
I’m trying very hard to not jump in and say that actually, you’re not talking about inheritance but subclassing- one implies the other, but they’re not the same. Clearly I failed.
1 reply 0 retweets 2 likes -
Replying to @NicolasRinaudo
I think I never considered anything other than subclass inheritance to be inheritance... though I've been encouraging careful distinction between subtyping and inheritance for years...
1 reply 0 retweets 2 likes -
Replying to @propensive
But subclass inheritance implies subtyping, doesn’t it? I agree that inheritance and subtyping are distinct concepts, but if you consider that only subclass inheritance exists, how is it distinct from subtyping?
1 reply 0 retweets 0 likes -
Replying to @NicolasRinaudo
Subtyping concerns a superset relationship on the set of provable properties of a type (e.g. method signatures), and inheritance concerns the sharing of the runtime implementations of none, some, most or all those properties, and is conferred (only, I thought...) by subclassing.
1 reply 0 retweets 0 likes -
Replying to @propensive
Here’s my current understanding: subtyping is telling you “A is a B”, inheritance “A has access to a known subset of B’s code”. I believe modules can inherit from one another and they’re not classes, the same argument goes for typeclasses.
1 reply 0 retweets 0 likes -
Replying to @NicolasRinaudo @propensive
There is, of course, clearly an ancestor / descendant relationship, but it needs not be semantic - subclassing mixes the two, at least in languages like scala and java, but it’s not a necessity. C++ has inheritance without subtyping, java subtyping without inheritance
1 reply 0 retweets 0 likes -
-
Replying to @NicolasRinaudo
I'm coming to the conclusion that "subclassing" should only ever be used to talk about relationships between classes, not between types (or instances). Does applying that constraint remove some ambiguity?
1 reply 0 retweets 1 like -
Replying to @propensive
Mmm... I might have assumed the wrong implied flaws when you talked about the negative connotations of inheritance. I assumed inflexible hierarchies (and related issues), but that’s not what you meant, is it?
1 reply 0 retweets 0 likes
That is the main thing, along with how it facilitates code which depends on non-contractual details of the inherited implementation which get falsified when someone overrides one of them. Let's call these "insincere invariants".
-
-
Replying to @propensive @NicolasRinaudo
I'm not sure whether overriding or the default of nonfinality should be more specifically to blame here than inheritance itself, but I was lumping them together as part of the same problem.
1 reply 0 retweets 0 likes -
Replying to @propensive
Right, and that’s why I reacted - this lumping is correct with mainstream OOP but some flaws are subtyping specific and other inheritance specific. But perhaps I’ve carried this thread on too far, apologies :)
1 reply 0 retweets 0 likes - Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.