On 1/12/07, Helder Ribeiro <helder / gmail.com> wrote:

> 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'.

Yes, this is true.

However the issue is rarely with immediate dependencies, but dependency chains.

I.e., with mixins,

If I have A->B->C and C mixes in D, then E

the lookup is C,E,D,B,A

which logically is quick intuitive if you think about it.

If I have A->B->C

and  ?->D->C

and

?->E->C

Those two question marks represent two independent dependency chains
that you cannot be sure what they implement without knowing the
ancestors of each.

Since modules live outside of the hierarchy, you will only be likely
to run into this problem with bad design.  The point of mixins (and
multiple inheritance) really, is to address orthogonal concerns.  Name
collision is a sign of either a code smell, or just a really complex
system that is going to need a lot of thought to begin with.