, , , scala.collection.immutable.Map, scala.Map.
-, V . , a SoftMap[String, Dog] SoftMap[String, Any]. .
trait Contra[+A] {
def a: A
def m(a: A)
def n[AA >: A](a: AA)
}
Typesafe mutable collections - : . .
collection.mutable.Map :
trait Map[A, B]
extends Iterable[(A, B)]
with scala.collection.Map[A, B]
with MapLike[A, B, Map[A, B]]
, :
scala> trait SoftMap[K, +V] extends collection.mutable.Map[K, V]
<console>:25: error: covariant type V occurs in invariant position in type [K,+V]java.lang.Object with scala.collection.mutable.Map[K,V] of trait SoftMap
trait SoftMap[K, +V] extends collection.mutable.Map[K, V]
^
:
scala> trait SoftMap[K, V] extends collection.mutable.Map[K, V]
defined trait SoftMap
, , , + , , Scala 2.8. +=.