4 ms·
Which is precisely the idea of covariant getters / contravariant setters in some sounder languages.
by STRML 10y ago
Which is precisely the idea of covariant getters / contravariant setters in some sounder languages.
- Kreeg 10y agoIIRC, Scala has covariant/contravariant generics (apologies for the bad terminology, I'm not too familiar with the details)
- Groxx 10y agosupport for "<? extends X>" and "<? super X>" is supporting covariant / contravariant. invariant would be "<x>". basically. the same concept applies in a number of areas, with varying support (e.g. Java doesn't support contravariance in its method overloading: http://stackoverflow.com/a/2501513/16295 http://stackoverflow.com/a/2501513/16295 )