Objects are the only way in TOM to create an aggregate value---there is no such thing as a struct.
All objects---classes and instances---share the same type. Obviously, the compiler can tell a difference between a Number and a ByteArray, so not all objects are of the same kind.
A variable with an object type actually is a reference to an object. All objects are allocated from a heap.
In the rest of this document, often the type of an expression or entity is referred to. In most cases, this means the type of the value, or the kind of object if the type is the object reference type.
The default value of an object-typed variable is the invalid reference, nil. The type of nil is _builtin_.Any. Messaging nil results in the condition nil-receiver being raised.
object_type: class_name | `id' | `class' `(' object_type `)' | `instance' `(' object_type `)' ; |
The plain object_type is a class_name; this indicates the instance of the indicated class. id indicates the type of the actual receiver. The variation with a `class' or `instance' shifts the meta level into the specified direction. Examples:
A reference to an instance of Foo (or an instance of a subclass of Foo).
A reference to the Foo class object (or the class object of a subclass of Foo).
A reference to an instance of the current receiver. Obviously, it is an error if the current receiver itself is an instance, since instances do not have instances.
A reference to the class object of the current receiver. For the current receiver being an instance, it denotes the class object; for a class it denotes the meta class object. For meta class objects, it denotes the meta class object of the State class.
As the receiver of a method invocation, a class_name denotes the class object.