Hacker News new | ask | show | jobs
by catnaroek 3689 days ago
If you want to extract an apple from a list of fruits, you need runtime type information (so that you can test whether a particular fruit object happens to be an apple), which has nothing to do with whether your language has inheritance or not. Using runtime type information is a symptom of bad design, though, since it lessens the extent to which you can reason about programs (as pieces of text) by just looking at their types.
1 comments

I agree with you all. All I say is that suggesting delegation in place of inheritance to address contravariance issue seems off the mark.