From: Intransition Date: 2011-07-21T09:03:53+09:00 Subject: [ruby-core:38283] Re: Questions about Module#mix On Jul 18, 3:19�am, Yehuda Katz wrote: > Hi, > > I have seen Matz propose a new feature: Module#mix several times for > inclusion in a future version of Ruby. > > I am unsure about what use-case #mix is attempting to help with. In current > Ruby, all modules are including in the ancestor hierarchy. This means that > it is possible to use modules as a form of runtime extension of the class > hierarchy, and to use `super` between included modules. > ... I share your concerns. On the face of it looks like Matz wants to push Ruby over to a traits system. I recall he once said that if he knew about traits at the time he would have gone that route rather than the current mixin system. However, I tend to think he may have made the right decision. It's just that he is reluctant to fully accept it for what it is -- that mixins really are a form of multiple-inheritance. Why can't we just embrace that fact, drop the distinction between module and class, get prepend in there, and party on. That to me seems like progress. I'm not so sure how traits would provide a better improvement. According to the proposal an *error* occurs if a mixed module shares a method with the receiving class/module. But I wonder why b/c I recall Matz also proposing that method "redefintions" will honor super in a future Ruby, creating a sort of inner-class hierarchy. If that becomes the case then I don't think there is a need for such an error. Is there? And more to the point, we in effect get an our mixin system back, just in a different place. But I'm not sure its a better place. But which ever is better, it seems to me it the Ruby needs to support either one or the other, not both, either traits or mixins.