Skip to main content
5 events
when toggle format what by license comment
Dec 5, 2015 at 18:43 comment added supercat I think what would be needed to make code sharing work would be a mechanism similar to generics, so that one could have a Foo<normal> and a Foo<quasiDerived> as different types which share the same code, and whose base methods can each work on items of their own type, but that's very different from normal derivation.
Dec 5, 2015 at 18:42 comment added supercat If one is going to have a concept of classes being able to access private or protected members of other instances of those same classes, I don't see any way to get that without combining structural inheritance and subtyping. One could have rules which said that a Foo should be allowed to regard a QuasiDerivedFoo as a Foo, but nobody else should be allowed to implicitly regard a QuasiDerivedFoo as a Foo. If a Foo is allowed to regard a QuasiDerivedFoo as a Foo, however, there's no way to avoid the possibility of Foo returning an instance of QuasiDerivedFoo to code expecting a Foo.
Apr 19, 2015 at 22:19 comment added bwcoder Makes sense. I sure have seen cases where you would want either just inheritance or just subtyping.
Apr 19, 2015 at 7:16 history edited Thiago Silva CC BY-SA 3.0
fix wording
Apr 19, 2015 at 6:06 history answered Thiago Silva CC BY-SA 3.0