Squeak vs. SuperCollider Class systems
Comparing the class systems of Squeak and SuperCollider.
Here is a transcript of different things IZ and JR tried out on a nice Friday morning in February 2001 at the SIM office:
The class of the class of ... an object in SuperCollider:
1.class -> Integer
1.class.class -> Meta_Integer
1.class.class.class -> Class
1.class.class.class.class -> Meta_Class
1.class.class.class.class.class -> Class
1.class.class.class.class.class.class -> Meta_Class
1.class.class.class.class.class.class.class -> Class
In other words... some facts:
- An object such as a number is an instance of a class, such as Integer.
- A class such as Integer is the sole instance of a class called Meta_, (i.e. the class of Integer is Meta_Integer). That is: each "metaclass" has only one instance, namely the class it defines
- A :"metaclass" such as Meta_Integer is an instance of Class
- Class is an instance of Meta_Class. By 2 above, Class is the sole instance of Meta_Class.
- Meta_Class is an instance of Class
- Circularity:In SuperCollider, Class is the sole instance of Meta_Class and Meta_Class is the sole instance of Class.
- All metaclasses are instances of Class, so is Meta_Class. So Class has as many instances as there are metaclasses.
The class of the class of ... an object in Squeak:
1 class -> SmallInteger
1 class class -> SmallInteger class
1 class class class -> Metaclass
1 class class class class -> Metaclass class
1 class class class class class -> Metaclass
1 class class class class class class -> Metaclass class
1 class class class class class class class -> Metaclass
- An object such as a number is an instance of a class, such as SmallInteger.
- A class, such as SmallInteger, is the sole instance of its "class-class". This is parallel to SuperCollider's "Meta_<class>" group of objects, but prints in the form of <Classname> class, not in the form "Meta_<class>". For example, in SuperCollider the result of the expression
LinkedList.class</code >, prints as <code>Meta_LinkedList</code >, whereas in Squeak the result of the expression <code>LinkedList class</code > prints as <code>LinkedList class. Note that the result prints identical to the expression evaluated but in fact the first one is an expression where the message "class" is sent to the object "LinkedList" and the second one represents the object "LinkedList class", which is the class of LinkedList.
- The "class-classes" are all instances of Metaclass.
- Metaclass is the sole instance of Metaclass-class. So the difference is that in SuperCollider Meta_Class is an instance of Class, but in Squeak Metaclass is an instance of "Metaclass class".
The instances and subclasses of Class
Ergo: SuperCollider uses both instances of Class and subclasses of Class to define Metaclasses. Squeak uses subclasses of Class to define its class-classes, but it does not use any instances of the class Class itself.
- In SuperCollider, Class has all Meta-classes as instances and Meta_Object as sole subclass.
- In Squeak, Class has no instances at all, and ObjectTracer class, PseudoContext class, ProtoObject class as subclasses.
Links to this Page