From: gabriele renzi Date: 2005-04-25T00:34:31+09:00 Subject: Re: [ANN] Article: Seeing Metaclasses Clearly Mathieu Bouchard ha scritto: > > On Sun, 24 Apr 2005, gabriele renzi wrote: > >> Mathieu Bouchard ha scritto: >> >>> On Thu, 21 Apr 2005, ts wrote: >>> >>>> * a class is a module which can use inheritance >> >> I disagree, thinking that mixins and multiple inheritance are not the >> same thing, and should not be pointed as such. > > > Take a look at the inheritance mechanism in CommonLISP and how the > (call-next-method) macro works in LISP and then you won't be able to > honestly tell me that mixins are not inheritance and that Ruby's mixins > aren't like Lisp's classes. Really. Go see for yourself. I'm not much into CLOS, but IIRC the basic approach is to linearize the ancestors (not thinking of MOP, method combination and so on). I can agree this yields similar result to our mixin strategy, but I fail to see how it shows mixins are MI. It would at best show that CLOS' MI is similar to ruby's mixins. If I would talk about how Eiffel or C++ handle the problem differently would that prove my they MI!=mixins, or would show that CL has not MI or simply that there are diferent approaches to the problem? You snipped out (or I misquoted it) the part I was actually referring: >> Module#include qualifies as inheritance, no matter how one may try to >> hide it under a carpet. A dog with a leg missing is still a dog. The core idea of MI (to me) is the ability to inherit two things that would need to be instantiated, while using mixins this is impossible. And a man with big ears do not qualify as a rabbit to me . >>> 1. a Ruby class is a direct-subclass-of a Ruby class using the "<" >>> notation (except the Object class). >>> 2. the Object class just happens to be the place where .new() is >>> defined; and this is no matter how many classes use >>> undef_method(:new) to forbid instantiation. >> >> Is'nt it Class#new ? > > > Sorry, yes. But it amounts to the same thing, because the (Object) > metaclass is the sole direct descendant of Class, and the creation of a > new class never can add a new direct descendent to Class, and so it > would be possible to unify the (Object) metaclass and the Class class > and frankly no-one would notice. > > Guy Decoux and you are right on this detail, but this detail is not > important in my point, neither was in mine, just a note :) > and here is what I mean: I mean that what makes a > class a class is that it inherits from whatever is the sole authority > for making new objects, and that's something that non-class modules > don't have access to. > > (And although there *are* some pieces of code that might construct new > objects without the help of Class#new, it isn't the one you can use for > building objects of your own custom-designed non-singleton classes) > > Does that clear up things a bit? I think I understood this, *this* is what I think as the difference beetween mixins and MI :)