From: Pat Maddox Date: 2007-10-08T02:42:15+09:00 Subject: Re: The Case for Multiple-Inheritance On 10/7/07, Trans wrote: > > > On Oct 7, 9:13 am, "Pat Maddox" wrote: > > On 10/7/07, Austin Ziegler wrote: > > > > > > > > > On 10/6/07, Trans wrote: > > > > The thing is (and maybe this will help clarify how I see this) the > > > > more I work with Ruby the more I feel like the best code is always of > > > > the form: > > > > > > module M; end > > > > module X; end > > > > module Y; end > > > > > > class Z > > > > extend M > > > > include X > > > > include Y > > > > end > > > > > > Such that everything is a module and classes are always just > > > > compositions of modules. This provides maximum code reusability. > > > > > I'll put it clearly: if I were running a Ruby consultancy and a > > > programmer of mine used your methodology for everything (e.g., classes > > > defined by composing modules), I would not keep that programmer on. It's > > > a bad style. Sorry. > > > > Agreed. That looks painful. > > Bahahahahahahahahaha! > > You're right! But it's only painful b/c it's what you HAVE to do today > to achieve this level of code reuse. If I had my way, it would as > simple as: > > class X > def self.foo # instead of needing M > ... > end > > class Y; end > > class Z > is X > is Y > end > > And we'd still have complete code reuse. > > T. > > > You misunderstand me. What looks painful to me is having the behavior of a class tucked away behind 15 different modules, instead of being right in the class where it belongs. Pat