How is Ruby module inclusion not really 'multiple inheritance' and how does the Ruby style avoid the problems associated with multiple inheritance?

mixins, multiple-inheritance, ruby

Solution

Adding this on Mladen's behalf as an actual answer, because I found it very helpful, and I'm guessing answers get indexed better for whatever crazy things SO does with it.

Here is a nice article on that matter, see if it answers your question: http://artima.com/weblogs/viewpost.jsp?thread=246488 – Mladen Jablanović Oct 28 '10 at 18:23

Problem

Matz supposedly said "mixins could do almost everything multiple inheritance do, without the associated drawbacks" (Matz words)." First of all, why is Ruby module inclusion not 'multiple inheritance' ? It seems to me there is very little difference between modules and classes. The fact you cannot instantiate a module is irrelevant when it is used as a superclass. I also know that successive module inclusion forms a single inheritance chain (not tree) extending upwards from the class. But this, to me, is not sufficient to distinguish it from 'multiple inheritance' as the Python multiple inheritance system also "linearizes" the superclass chain (using the C3 algorithm) it's just that Ruby 'linearizing' process is significantly simpler. So what exactly distinguishes Ruby module mixins from multiple inheritance in say a language like Python? And why don't the arguments behind the Python adoption of the c3 MRO algorithm apply to Ruby? And if they do apply - why did Ruby decide not to adopt this algorithm ? thanks

Original source