>>>>> "N" == Ned Konz <ned / bike-nomad.com> writes:

>> The equivalent of bless, in ruby, is just to change RBASIC(obj)->klass

N> Is there a way to do this safely in pure Ruby?

 I don't think, but you must see that it exist a *BIG* difference between
ruby and perl. You say that the perl's system is simple, personnaly I'll
say that it's poor (it's a hack).

 For person which don't know, in perl an "object" is just a reference which
know its stash and bless just associate a stash with a reference.

>> and  perl don't have (natively) the equivalent of singleton classes.

N> Yes, that's why we wrote Class::Prototyped. Because of the simplicity of 
N> Perl's type system, it was easy to make up a new unique name for the 
N> singleton class (we based it on the object address). The singleton class then 
N> inherits behavior (and data, using closures) from its parent slots using 
N> Perl's multiple inheritance (the @ISA array).

 Heresy :-)))

 Seriously, I'll never try to compare perl with ruby on the OO model,
 because perl will lost :-))) (and I've used perl)



Guy Decoux