About reflection and it engineering
Daniel Joyce
daniel.a.joyce at worldnet.att.net
Wed Nov 5 21:58:46 UTC 2003
On Wednesday 05 November 2003 14:21, Sam Adams wrote:
<snip>
> In Smalltalk, metaclasses are instances that model classes, and Metaclass
> is the class for all models of classes.
>
> Of course, we can't have "turtles all the way down", so Metaclass itself is
> modeled and implemented by subinstances of itself.
>
> It is amazing how much value we have recieved from this model, but as Alan
> has mentioned on occasion, we have rarely revisited Metaclass or thought of
> its potential siblings.
>
> Years ago when I taught lots of classes on Smalltalk, someone in each class
> always asked the "so what is the class of a class of a class?" question.
> Its not necessary to understand the answer to get lots of value from
> Smalltalk, but a thought vacation to metaland can be very interesting. It
> can also give you a powerful lever on design complexity in many domains.
>
> <meta-meta-meta-meta>
> Consider that there is effectively only one Metaclass in Squeak, in that
> all classes have a fixed set of ways to define their structure and behavior
> and that of their instances. But that one Metaclass defines the entire
> universe of all classes and instances directly implementable in Smalltalk.
> (Of course, you can use Smalltalk to indirectly model almost any concept,
> but not directly in the sense that you have to create a simulacrum of your
> concepts using the Smalltalk concepts of objects, instances, classes,
> messages, methods, etc.)
>
> Now can other kinds of Metaclass exist? Of course they can, and each would
> provide a definition for an entirely separate universe of classes and
> instances parallel to the currently Smalltalk universe. For example, a
> class system where all classes must have two and only two superclasses, and
> are limited to integer instance variables and unary messages. At this
> metalevel you would find Metaclasses that define entirely distinct object
> systems, including lots of those other "object" languages.
<snip>
> Regards,
> Sam
Check out Python's new class heirarchy then. There is the standard object
system, using built in classes-metaclasses, and then one can easily define
their own metaclasses as needed.
Singletons are extremely easy, as would a protoype based language be too.
I haven't played with the meta programming level in Python much, but it's very
powerful under there.
>
>
> Sam S. Adams, IBM Distinguished Engineer, IBM Research
> tie line 444-0736, outside 919-254-0736, email: ssadams at us.ibm.com
> <<Hebrews 11:6, Proverbs 3:5-6, Romans 1:16-17, I Corinthians 1:10>>
More information about the Squeak-dev
mailing list
|