next up previous contents index
Next: Classes and Inheritance Up: Overview of the Previous: The Theta Type


New types and routines are defined by providing _specifications_ (9). A specification defines interface information; it does not include any information about how the new type or routine is to be implemented. This is given separately, and a type or routine can have many different implementations.

The specification of a type defines the supertypes, and the names and signatures of the methods. A type can have multiple supertypes, and the methods of the supertype can be renamed in the subtype.

A type specification only defines the methods of the type's objects and thus provides no way to create new objects ``from scratch.'' Creation is accomplished through the use of routines that are not part of the type. Keeping creation separate from the type means that a subtype's creators need not be related to those of its supertypes, and it allows different implementations of the type to create objects differently. For example, a hash-table based implementation of a map abstraction would have a creator that takes the hashing function as an argument, while an array-based implementation would have a creator that takes no arguments.