I wonder if it is possible to unify the concepts of inheritance and parametric polymorphism ("generics") in general, especially in relation to variance, but also in terms of how ("syntax") and where (site-site / declaration-site) should they be defined?
Consider this point of view:
S <: T
T
S
final
There seems to be a non-price concept mismatch between them, given
String[] <: Object[]
In some languages, it can be seen that both work together well, although, for example,
class Foo extends Ordered[Foo]
to implement ordering / comparison behavior.
/ . , X, Y, Z . , a → b a b. <: , , "". ⇒ " ". :
X
Y
Z
a → b
a
b
<:
X <: Y ⇒ (Z → X) <: (Z → Y) X <: Y ⇒ (Y → Z) <: (X → Z)
( ) ( ). , - , , . , ( ).
, . (), (), (). , , .
, Scala . , Scala, , , . , , . ?
, , - " " .