4.7. Object type

Objects are the only way in TOM to create an aggregate value---there is no such thing as a struct.

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:

Foo

A reference to an instance of Foo (or an instance of a subclass of Foo).

class (Foo)

A reference to the Foo class object (or the class object of a subclass of Foo).

instance (id)

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.

class (id)

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.