Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
fnl
on March 17, 2018
|
parent
|
context
|
favorite
| on:
Inheritance Often Doesn't Make Sense
Which is only because Java doesn't understand contravariance. In Scala, that problem no longer exists.
kccqzy
on March 17, 2018
[–]
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.
fnl
on March 17, 2018
|
parent
[–]
Consumers are contravariant in Scala, but producers are covariant.
EDIT: Good reference:
https://www.atlassian.com/blog/software-teams/covariance-and...
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: