From: Mathieu Bouchard Date: 2001-08-08T14:37:16+09:00 Subject: [ruby-talk:19349] Re: Perl/Python/Ruby common backend (Parrot, can Ruby play too?) On Tue, 7 Aug 2001, Phil Tomson wrote: > Questions for the Ruby community to ponder: What sorts of features do > we need that might be unique to Ruby? [One that comes to mind: the > ability to extend an existing class.] For the most part, I think our > needs are very similar to Python's. Like has been said, adding stuff to an existing class is not Ruby-specific, Python has it, but also, Perl has it. (Although Ruby people seem much more willing to do it.) Ruby has this thing called "mixins" that afaik is not in Python (unless it's quite recent) and is not in Perl. In Perl you have multiple inheritance, but the dispatch is C++-style, so calling SUPER looks always upwards. Ruby backtracks in the method lookup. (Damian wants that in Perl6) Ruby also has metaclasses (singleton classes that inherit from the Class class). Perl doesn't even have Class objects. Oh, Ruby also has singleton classes, which implement adding methods and superclasses to objects. Ruby has closures, which allow to modify existing variables of the enclosing binding. For closures there is a special slot "&" in every message that allows for the #each{} kind of methods. This is a small and possibly incomplete list. OTOH, Ruby *doesn't* allow to change an object's class, unlike Perl and Python. The exception to that is when a object has class=Foo and changes to class=(new singleton class inheriting from Foo). matju