Metaclassing
Stephen Pair
spair at acm.org
Fri Dec 6 10:51:27 UTC 2002
Andreas,
You might have a look at: http://spair.swiki.net/21. This is the
delegation work I did, but it also has an enhanced version of
Hans-Martin Mosner's work on prototypes. Because I added delegation to
the VM, I was able to enhance his stuff to do instance based multiple
inheritance.
Anyway, you could look at the class ProtoBehavior which does a lot of
what you're talking about. It is a direct subclass of Behavior...so
it's probably not quite what you're after, but maybe it'll help in some
way.
In general, I'd say the biggest snafu that I encountered was that there
are certain messages that the Squeak environment absolutely requires all
objects to understand (like #nextObject). These are nicely encapsulated
in ProtoObject however (since you are talking about substitutes for
Metaclass, this should not be an issue for you.). This drove me nuts
because I wanted to be able to create objects that literally do not
understand anything (including #doesNotUnderstand:) and which used a
Mirror (reflection) to do anything like #instVarAt:, #instVarAt:put:,
#addMethod:, etc.
A ProtoBehavior could inherit behavior from any normal class in the
system...which would be nice for a clean implementation of eToys and
Uniclass behavior in general. But, unfortunately, it does require the
delegation capability in the VM.
- Stephen
> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On
> Behalf Of Andreas Raab
> Sent: Thursday, December 05, 2002 4:17 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Metaclassing
>
>
> Hi Guys,
>
> Has anyone ever tried to provide "Metaclass behavior" by some
> other class than Metaclass itself?! I have the need for
> something that is "similar to but not quite the same" as
> Metaclass' behavior (what I am effectively trying to do is to
> build a clean representation of Uniclass behavior as in eToys
> which may require instance ... err ... class ... err ... meta
> ... oh what the heck, STATE).
>
> What I am looking for is some primer on how to
> replace/subclass Metaclass (it drives me nuts just thinking
> about the fact that a subclass of Metaclass would also be an
> instance of Metaclass....) and/or any experiences in doing
> this. In particular little bits like "don't forget to XYZ or
> else the system will break" would be helpful ;-)
>
> Cheers,
> - Andreas
>
>
>
>
More information about the Squeak-dev
mailing list
|