Musings about modularity and programming in the large

itsme213 itsme213 at
Thu Jan 24 17:49:45 UTC 2008

"Ignacio Vivona" <altobarba at> wrote in message 
news:7d92ea5d0801240640x1766cf19md17c3e5d58b5c208 at
> why is not having metaclasses a nice feature?

It is about metaclasses not being "special" or hidden or singletons, but 
being just as user-accessible, definable, instantiable, and extensible as 
any other object (and class). It is a much simpler meta-structure than 

e.g. See

NewSpeak seems to incorporate first-class namespaces and modules within this 
really clean and simple framework.

- Sophie

(If interested, here is a quote and a summary of that paper):

"This paper shows how an attempt at a uniform and reflective definition 
resulted in an open-ended system ... We propose to unify Smalltalk classes 
and their terminal instances. This unification allows us to treat a class as 
a "first class citizen", to give a circular definition to the first 
metaclass, to access to the metaclass level, and finally to control the 
instantiation link. Because each object is an instance of another one and 
because a metaclass is a real class inheriting from another one, the 
metaclss links can be created indefinitely."

Summary (all errors mine :-)
- Just 2 pre-defined classes: Object and Class
  - every object (including all classes) has instVars and behaviors
- Just 5 pre-defined instVars:
  All objects:
  - instanceOf: every object is instanceOf some class
  All classes:
  - name: name of class
  - supers: every class (except Object) has 1(+) super class
  - instanceVariables (of its instances)
    instanceMethods (method dictionary of its instances)
     - every class has these
     - these control instVars and behaviors of instances of that class
- Just 2 pre-defined behaviors:
  - #send:args: every object supports this
  - #basicNew: every class supports the #basicNew primitive
     - #basicNew on a metaclass produces another class
  - A terminal (i.e. non-class) object does not respond to #new
- Class is subclass of Object
  - so every class is an object
- Class is an instance of Class
  - so the instVars and behaviors of Class are defined by Class
  - Class is the initial primitive "metaclass"
- Object is an instance of Class

- Meta-stuff is now nothing special
  - "As a common object, a class is defined by its class
     and the values of its associated instances variables", no more
  - Any subclass (direct or indirect) of Class is a meta-class 

More information about the Squeak-dev mailing list