http://www.dartlang.org/docs/spec/dartLangSpec.pdf
The language spec for Dart mentions below
Dart supports optional typing based on interface types.
The type system is unsound, due to the covariance of generic types. This is
a deliberate choice (and undoubtedly controversial). Experience has shown that
sound type rules for generics fly in the face of programmer intuition. It is ..
- Can someone elaborate further on the reason type system is unsound?
- What was the Dart lang spec writers thinking when they say sound type rules for generics fly in the face of intuition?
Take a look at the related questions to the right of this one. I see:
List<Number>not a sub-type ofList<Object>?List<Derived>to aList<Base>?list<MyClass>toList<object>?Animals[] animals = new Cat[5]compiles, butList<Animal> animals = new List<Cat>()does not?While covariance isn’t sound (for many mutable types), it is the behavior that many programmers intuitively expect when they first start working with generic types.