4 ms·
Multiple inheritance is the major one for me.. been waiting a long time for this
by propercoil 14y ago
Multiple inheritance is the major one for me.. been waiting a long time for this
- nahname 14y agoWhat does multiple inheritance provide that isn't better achieved through composition/modules?
- phillmv 14y agoWhy is that even something worth working on? I find modules work pretty good.
- account_taken 14y agoAgree with you. Didn't we learn from C++ that multiple inheritance is good in theory but in practice a horrible idea? Ruby already lets you be 'magical' in too many ways.
- pjmlp 14y agoIt is also available in Eiffel, OCaml and Python. So there are some good ways to make use of it. But I agree interfaces/traits is a better way of dealing with multiple inheritance scenario.
- draegtun 14y agoPerl (5 & 6) also has multiple inheritance. Current best practise in the Perl community is to avoid using MI and instead make use of roles. ref: https://metacpan.org/module/Moose::Role https://metacpan.org/module/Moose::Role | http://en.wikipedia.org/wiki/Perl_6#Roles http://en.wikipedia.org/wiki/Perl_6#Roles | http://modernperlbooks.com/mt/2009/05/perl-roles-versus-inheritance.html http://modernperlbooks.com/mt/2009/05/perl-roles-versus-inhe...
- lloeki 14y ago> Didn't we learn from C++ that multiple inheritance is good in theory but in practice a horrible idea? No, we learned from C++ that C++ multiple inheritance is an atrocity. Python's MI works in a clear and obvious way, similar[0] to how the Ruby inheritance chain is clear and obvious. MI really doesn't fit Ruby though, and IMHO would look too bolted on. Most of the time the problem is people beating the platform they develop on into submission, instead of embracing it by getting a clear picture of what happens. [0] As _why said[1], python and ruby are damn close: you can easily get something similar to Ruby's modules and inject them dynamically in the inheritance chain: https://gist.github.com/3951273 https://gist.github.com/3951273 [1] https://github.com/whymirror/unholy https://github.com/whymirror/unholy
- lmm 14y agoMagic is bad, but multiple inheritance isn't magic; it's clear and obvious, the only potential wrinkle being method resolution order when two superclasses define the same method, which is fine as long as it's consistent and documented. Almost all of the problems with multiple inheritance in C++ are to do with the static type of an instance, and go away in a language where everything is virtual by default, as in ruby.
- gamache 14y agoSometimes you want to express multiple is-a relationships at the same time. In that case, composition is a hack, and multiple inheritance is a better match for the concept. I prefer having more options how my objects behave than fewer. But, since Ruby 2.0 does not and will not have multiple inheritance, this is all off-topic.
- muirbot 14y agoI'm seeing contradictory information about this. Is multiple inheritance in or out?