Chapter 4. Basic types

Table of Contents
4.1. Numeric types
4.2. The boolean type
4.3. The pointer type
4.4. The selector type
4.5. The void type
4.6. The dynamic type
4.7. Object type
4.8. The id type
4.9. Tuple types

TOM has three kinds of types: basic types, objects and tuples. Furthermore, there is one special type, void, and there are two special type indications: dynamic indicates that the actual type will be dynamically checked; and id which, in denotes an actual object instead of the containing, declaring, formal object.

        | tuple_type
        | object_type

An entity_type is the possible type of an entity, such as an object variable, method argument or local variable.

        | entity_type

In addition to the usual types, an argument can have the dynamic type. The type actually passed will be encoded in the selector of the method being invoked. It is the responsibility of that method to retrieve the correct types as indicated by the selector.

        | argument_type

The type of value returned by a method can be anything that can be the type of an argument, plus void, indicating that the method will not return any value.

          `byte' | `char' | `int' | `long' | `float' | `double'
        | `boolean' | `pointer' | `selector'

4.1. Numeric types

TOM has two kinds of numeric types: integer and floating point. The integer numeric types are listed in Table 2-1. In places where a numeric type is expected, a narrower numeric type of the same kind is accepted and implicitly converted. Thus, a byte is acceptable as a char is acceptable as an int is acceptable as a long; and a float is acceptable as a double.

The default value for the numeric types is zero.