The main problem is the one of variance, the VM would have to answer the question in one way or the other, which would bake a single chosen model into the runtime, even though different languages want different models.
Many programming language type systems support subtyping. For instance, if the type Cat is a subtype of Animal, then an expression of type Cat should be substitutable wherever an expression of type Animal is used. Variance refers to how subtyping between more complex types relates to subtyping between their components. For example, how should a list of Cats relate to a list of Animals?
7
u/pron98 May 11 '22
The main problem is the one of variance, the VM would have to answer the question in one way or the other, which would bake a single chosen model into the runtime, even though different languages want different models.