From: Paul Brannan Date: 2003-12-04T03:45:37+09:00 Subject: Re: mixin vs. multiple inheritence On Thu, Dec 04, 2003 at 03:09:52AM +0900, T. Onoma wrote: > What you say is true enough. But I am wondering what it is that supposedly > Mutiple-in gives you that Mix-in does not, which was implied by matz, albiet > that the it is better Ruby's way. I'm going to speak about inheritance of implementation here; inheritance of interface is a separate issue that doesn't really apply to Ruby. With multiple inheritance, every class knows exactly what its immediate ancestors are and can explicitly call functions in those classes. However, complex hierarchies that depend on subtleties of relationships between base class and derived class are generally brittle and hard to follow. With Ruby's mixins, because inheritance is always single-inheritance, Ruby may adjust the order of inheritance so that a class or module doesn't necessarily know what its immediate ancestors are. This is less flexible, but it's conceptually much simpler and easier to implement than MI. I'm yet to see an example using inheritance of implementation where multiple inheritance would work but Ruby mixins would not that didn't make me cringe. Paul