From: Austin Ziegler Date: 2007-10-07T07:21:48+09:00 Subject: Re: The Case for Multiple-Inheritance On 10/6/07, Sylvain Joyeux wrote: > On Saturday 06 October 2007, MenTaLguY wrote: > > On Sat, 2007-10-06 at 08:47 +0200, Sylvain Joyeux wrote: > > > Yes. You have to think, when writing mixins, in the context of *all > > > other mixins they will have to interact with*. Mmmmmm ... looks like > > > MI problem to me. > > That's because, since mixins aren't abstract (like interfaces), they > > represent a limited form of MI. The limitations on Ruby modules only > > mitigate the issues inherent in MI, not eliminate them. But .. do you > > really want to make the issues worse by relaxing the restrictions? > I think that programmers should have the right to do their own decisions. > If they don't feel like using MI, fine. But an anti-MI religion. They do, but not all of those ways are possible in Ruby. C++ (as noted) is really bad at delegation; Ruby excels at it. C++ is *better* for MI (because of the explicit support and such) than Ruby, even with mixins. But Ruby tends to be more compact and useful for most models. > All powerful programming tools have drawbacks. The question is whether or > not you gain more by taking the risk of using them than by avoiding them. > I already used MI in C++ (and yes, for "is-a" relations, cut the > you-should-not-use-inheritance crap) and I have seen people using MI in > very elegant ways. It is useful in some cases, can be avoided in others, > but it is useful sometimes. I'd say it should be avoided 98% of the time (MI). Inheritance in general, is probably overused by at least 50%. (Most is-a relationships aren't useful ones and are caused by people who aren't used to thinking of OOP in other terms. I'm not suggesting this for you, but is-a has a lot of implications that has-a doesn't. Therefore, it's not "you-should-not-use-inheritance crap", it's sound advice from years in the industry.) -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca