A language that permits user-defined types must provide constructs for the user to specify the properties of such types. If user-defined types can be named, then defining and applied occurrences of type identifiers must be recognized and checked for correct usage.
Here are some examples of user-defined types in Mystery:
TYPE Inches = INTEGER; TYPE Length = Row; TYPE Matrix = ARRAY [1 TO 10] OF Row; TYPE Row = ARRAY [1 TO 10] OF Inches; TYPE Column = ARRAY [1 TO 10] OF Inches; TYPE Math = PROCEDURE (i: Inches, r: Row): Column;
This sequence of type declarations defines six type identifiers
The second declaration states clearly that the identifiers
Row name the same type, but the identifiers
Column may or may not name the same type
(see Type equivalence).
Finally, the type
[1 TO 10] is anonymous; it is not named by
any type identifier.
Computational roles to support user-defined types are provided by the
Typing module (see Typed Entities):
Typeattribute is a new, unique, definition table key.