Go to the first, previous, next, last section, table of contents.


Extensions

A class does not need to be defined by one monolithic definition; its definition can be split into multiple so-called extensions. A class definition always has at least one extension; this nameless extension is called the main extension. All other extensions have a name which must be unique within the class. Extensions are not limited by unit bounds: it is legal for a unit to define an extension of a class defined in any unit known to the compiler.

An extension can introduce new superclasses, behaviour and state, and it can replace methods previously defined in other extensions of its class

[Note: `previously' implies an ordering of extensions. This ordering is undefined except that the main extension precedes all other extensions. End note.]

In the context of dynamic loading, the addition of state (either directly or by inheritance) is only allowed if no objects which are to carry that state have been allocated yet. Since all class objects are pre-allocated, the addition of non-static state to class objects is not possible.

Syntax

extension:
          `extension' identifier
        ;


Go to the first, previous, next, last section, table of contents.