From: Mathieu Bouchard Date: 2001-08-12T13:40:52+09:00 Subject: [ruby-talk:19570] Re: Perl/Python/Ruby common backend (Parrot, can Ruby play too?) On Wed, 8 Aug 2001, Piers Cawley wrote: > Mathieu Bouchard writes: > > > You can 'sort of' do mixins with perl > > > BEGIN { > > > do "Module.pm" || die "Couldn't load module"; > > > } > > > just make sure that 'Module.pm' doesn't have a package declaration. As > > > you can no doubt see from its cumbersome syntax, mixins are not > > > generally used within perl. > > That's way too sort-of to be called "mixins" > Maybe I'm completely misunderstanding what ruby's mixins are. From my > reading of the pickaxe book, mixins are simply chunks of code that get > compiled into the class that includes them. Which is what the perl > code above does too. mixins are way closer to multiple inheritance than that. > Well... one could argue that in most cases where Perl does MI, the > 'extra' parent classes are used in the same way as ruby mixins, and You can't do real ruby mixins in Perl, at least not the way I use them. > Hang on, I'm confused. You seem to imply that mixins can inherit from > other mixins. Or is it that Ruby mixins only get compiled once (if you > try that in Perl you end up having *enormous* problems with SUPER:: at > the moment...) mixins inherit from other mixins statically through their inheritance list (think @ISA), *and* dynamically, because the 'statically' part is just a special case in a larger scheme of making 'super' work as the _continuation_ of the method-lookup. matju