[self-interest] Class::Prototyped - Fast prototype-based programming in Perl
tua at everettak.org
Thu Aug 2 12:12:24 UTC 2001
> Toby Everett and I have come up with a Perl module that gives Perl a
> Self-like object model. If you're interested in using prototype-based
> programming but can't get Self to work, you might consider this.
Just to make a side note, one of the things we have demonstrated through this
is that it is possible to add prototype-based semantics to class-based
object-oriented languages that support run-time inspection and creation of
classes. The metaphors of Self: prototype-based, mirrors and reflection, and
slots, both data, method, and parent, all translated very well and proved very
effective in what is still a very Perlish system. The end-result is that I
can write Perl code using the approaches one uses in Self, and it is a very
liberating and exciting feeling. One overloads the + operator by adding the
method slot '+'. Classes and objects are both first-class citizens - they are
virtually equivalent in the eyes of C::P (the only difference is that named
classes persist even if there are no references to them, where as objects
experience normal destructor behavior). Perl becomes a guise for Self:).
I see no reason why this same thing couldn't be done in other dynamic
class-based object-oriented languages. Basically, all one has to do is write
a reflection system that uses the Self semantics and translates those into the
native inspection system.
More information about the Self-interest