Wilson Bilkovich wrote:
> >
>
> Multiple Inheritance can be extremely complex, as Gregory Brown has pointed out.
> One complication is that you now have to have rules to 'break ties'
> when you write:
> def hello
>   super
> end
>
> What if each of the parent classes has their own implementation of
> 'hello'. Which one is invoked? Mix-ins simplify this greatly, because
> there is still only one unambiguous superclass.

Ok, I see this is a problem with multiple-inheritance, but it doesn't
seem to me like one that using Modules solves. When checking another
discussion*, I went to the PickAxe to check method lookup with modules
and got this:

"The answer is that Ruby looks first in the immediate class of an
object, then in the
mixins included into that class, and then in superclasses and their
mixins. *If a class has
multiple modules mixed in, the last one included is searched first*."

That is, the exact same thing happens when you have a class include two
modules and both implement the 'hello' method. There is no self-evident
way of choosing, so you have to come up with an arbitrary choice like
that of order of call to 'include'.

>
> If you have used Java, they are like having Interfaces containing
> working code, as well as just a list of what should be implemented.

This is interesting. Does Ruby allow codeless methods in a module like
those of an java interface?

* The discussion I refer to is at
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/2f478cc54e2826a4/fd1ae73662ff8916?q=%22What%27s+so+special+about+operators%2C+built-in+classes+and+modules%3F%22&hl=en#fd1ae73662ff8916

I'm not done reading it yet but has been very enlightening so far. I
cite it so Kumar can take a look at it as I think it's related to this.
The next question that comes after the answer to "does it have multiple
inheritance" is "what's with those modules?!". I'll try and look up
more stuff so I don't repeat questions here. Thanks so far to those who
answered =)

Helder