https://kotlinlang.org logo
Title
r

Ruckus

10/25/2018, 6:48 PM
Is there a way to make this kind of type hierarchy? in this case
MutableVector2
cannot extend both
Vector2
and
MutableVector<...>
as it makes
T
conflict with itself.
d

dalexander

10/25/2018, 7:25 PM
Usually not. There’s a very common related issue that crops up in C++ https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern which causes a lot of problems with inheritance. The basic version of the problem looks something like:
class Foo: Bar<Foo>
and then trying to extend Foo to create Foo2 in a way that you want to it to also extend
Bar<Foo2>
which tends to lead to a bunch of problems. Thankfully this pattern is relatively rare on the JVM.
r

Ruckus

10/25/2018, 7:45 PM
Interesting, thanks for the link