4 ms·
Inheritance is two language features in one though—It's implicit delegation and type polymorphism. Those two features need not be coupled together like that, an
by jtregunna 16y ago
Inheritance is two language features in one though—It's implicit delegation and type polymorphism. Those two features need not be coupled together like that, and in fact, shouldn't in my opinion. It's not that silly things can be done with inheritance, it's more that people often use inheritance for one of two things, but rarely both: implicit delegation and type polymorphism. Pick your poison, and use the appropriate construct. I'm no fan of implicit delegation when I can get away with not having to deal with it, but I wish more languages would have an orthogonal construct for type polymorphism separate from inheritance.
- joe_the_user 16y agoYou express the situation quite well here. Are there any languages that do separate implicit delegation and type polymorphism?
- ericbb 16y agoGo does. See my other comment in this thread: http://news.ycombinator.net/item?id=2058963 http://news.ycombinator.net/item?id=2058963.
- jtregunna 16y agoAs mentioned by ericbb, there is Go, yes. I've been working on another; a prototype based OO language without inheritance, explicit delegation and type polymorphism, but have nothing I want to show just yet.