Im reading this page http://www.scala-lang.org/node/137, I understand what covariance is and lower bounds as well, but what it's not clear is this line:
Unfortunately, this program does not compile, because a covariance annotation is only possible if the type variable is used only in covariant positions. Since type variable T appears as a parameter type of method prepend, this rule is broken.
why elem
has to be an instance of a supertype of T
, if ListNode
is already covariant why elem
cannot be prepended to the current list.