Problematic combination of variance in Scala -


here example scala course on coursera:, lecture 4.4

class array[+t] {   def update(x: t) = ??? } 

this causes error in repl:

error: covariant type t occurs in contravariant position in type t of value x 

and on slides, martin says "problematic combination". why so?

this explained in "variance , arrays" section of http://www.artima.com/pins1ed/type-parameterization.html (from programming in scala odersky, venners, , spoon).


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -