Mixins need to be used with great care in dynamically typed languages. It's extremely easy to introduce dependencies on symbols in the class you're getting mixed into, and in larger projects it's not difficult to get name clashes between methods defined in different mixins, so that earlier mixins get clobbered by later mixins.
From my experience, I'm not a big fan of mixin-heavy development. Mixins need a lot of discipline. A mixin probably shouldn't exist if it doesn't have at least two, if not three different target classes it is mixed into.
I've seen mixins used for almost evil things in Rails. When mixins start adding before filters to controllers, disturbing amounts of magic can occur. You can end up needing to research a whole dependency dag and details of its implementation before you can understand a single method that may not refer to a mixin by symbol at all.
TFB(ook) by TFA(uthor) of TFA(rticle) discusses the issues with open recursion, and describes a pattern for using ECMAScript 2015 symbols to address this exact problem:
Depending on the use case the name clashing problem can be easily solved. For instance, in Lua the way I solve it is by simply letting multiple mixins define the same function, and whenever that function is called anywhere it triggers all of them. For game development this is extremely useful since usually when you have something like object:takeHit(attacker), multiple mixins that do different things in relation to getting hit (damage calculations, effects, animation, physics for pushback, and so on) define the takeHit function, but each of those different concerns is well hidden into their own separate mixin/module.
Of course I agree with you that mixins need a lot of discipline and I specifically follow the 2-3 different target classes rule. It's really really easy to fall into the trap of making everything a mixin but this is really the wrong way to go about it.
Self really had a nice solution to the issue: multiple named prototypes, properties not found on the root object would be looked up in all prototypes, and an error would be raised if multiple prototypes matched (requiring explicit resolution on the root object).
From my experience, I'm not a big fan of mixin-heavy development. Mixins need a lot of discipline. A mixin probably shouldn't exist if it doesn't have at least two, if not three different target classes it is mixed into.
I've seen mixins used for almost evil things in Rails. When mixins start adding before filters to controllers, disturbing amounts of magic can occur. You can end up needing to research a whole dependency dag and details of its implementation before you can understand a single method that may not refer to a mixin by symbol at all.