Several classes can be recognized in any TOM program, much like the standard classes in other languages. For example, in Smalltalk, the Object class resides at the root of the inheritance tree. TOM employs the following special types c.q. classes:
The implicit supertype of all object types. This type is not very useful, as it does not define any behaviour and can not be extended.
The implicit subtype of every object type: when used as the return type of a method that can return any object, the caller never needs to cast the value that is returned. For example, the following method is the only object retrieval method of the ObjectArray class (which offers a read-only array abstraction that stores object references) that actually directly retrieves an object:
Any at int index;
The conventional supertype of all object types. All classes should either inherit from State (see below) or both class object and instances should inherit from the instance (All). The instance All defines all kinds of behaviour that is useful for all objects, both class objects and instances.
Being the supertype of all objects, All can be used as the type of a formal argument, allowing any object type to be passed as an actual argument, without needing a cast. This is used, for example, by the only method of the MutableObjectArray class (which offers a read-write array abstraction that stores object references) that actually directly modifies the array:
void set All object at int index;
Every class must inherit from State for the instances to be allocatable. State is also the class that defines the isa object variables and that provides the designated way to create new instances, namely through the alloc class method.
The instance (All) is the conventional supertype of all objects, a fact that is visible in the definition of the State class:
implementation class State: instance (All) ... end; implementation instance State: instance (All) ... end;
The usefulness of the Top and Any types is restricted to compile time: they do not represent real objects that can be allocated or extended. The pervasive presence of All enables the addition of behaviour to all objects, not discriminating between instances and class objects, simply by extending the All instance. Similarly, behaviour can be added to all classes or all instances, simply by extending the State class or the State instance.
The State is a superclass of all classes that specify allocatable instances. State specifies the object variables that are needed in every instance and class object. State also is the class that provides the object allocation mechanism, through the alloc class method.
Every instance is described by its class, and every class by its meta class. The State meta class is also the meta-meta class of every meta-class. To prevent cycles, State can not inherit from classes that define class methods.