From: Piers Cawley Date: 2001-08-08T19:02:58+09:00 Subject: [ruby-talk:19368] Re: Perl/Python/Ruby common backend (Parrot, can Ruby play too?) Mathieu Bouchard writes: > (2-in-1 reply) > > > On Wed, 8 Aug 2001, A Bull in the China Shop of Life wrote: > > All this debate about Python vs Ruby is of questionable value IMO, they're > > This is not a Python vs Ruby debate, it's a comparison of features for the > sole purpose of knowing better what would need to be in a multi-language > VM to support Ruby. > > > On Wed, 8 Aug 2001, Piers Cawley wrote: > > Mathieu Bouchard writes: > > > Ruby has this thing called "mixins" that afaik is not in Python > (unless > > > it's quite recent) and is not in Perl. > > 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. > and AFAIK offers no advantage over Perl's multiple inheritance. Am I > right ? 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 restricting inheritance to single inheritance can make life a lot easier for some values of 'easier'. > Anyway the issue is, in a Perl/Python/Ruby VM, mixins with Ruby-style > inheritance is required, and so we'd have to make sure Damian's NEXT > proposal goes through. 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...) -- Piers Cawley www.iterative-software.com