Re:Inheritance Often Doesn't Make Sense
by kccqzy on Saturday March 17, 2018 @07:45AM
(#16606556)
No. When references or arrays of references are treated as contravariant, you would have the opposite problem of ArrayReadException. You can now store things into arrays safely but you can no longer extract things from arrays safely.
[ Parent
| on HN ]
Consumers are contravariant in Scala, but producers are covariant.
EDIT: Good reference: https://www.atlassian.com/blog/software-teams/covariance-and...