Metaclasses

The object/class model sometimes makes for subtle oddities. For example, in Smalltalk new is just a message, like any other message. The reciever for the message is a class, an instance of Class.

So, let us know ask where a constructor; that is, a class specific initialization, could fit into this picture. Such a method cannot be part of the collection of messages understood by instances of the class, since we do yet have an instance.

But such a message cannot be understood by class Class, since not all classes have the same constructor semantics. So, where should we put this behavior for individual class instances?

[audio] [real] Text to accompany slide12, in Chapter 5 of An Introduction to Object-Oriented Programming