49 Type Aliases

A type alias declaration gives a name to a type expression:

type Name = TypeExpression;

The declaration does not introduce a new nominal type and does not create a new carrier set. It binds the name on the left to the type denoted by the type expression on the right.

For example:

type Length = Real;
type Mass = Real;
type PointTuple = { Real x; Real y; };
type CircleTuple = { PointTuple centre; Real radius; };
type Names = Set<String>;
type PositiveReal = subtype Real where this > 0;
type ContactMethod = union { EmailContact, PhoneContact };
type ShapeTexture = intersection { Shape, Texture };

A type may have more than one name. For example, Length and Mass above are additional names for Real; they do not introduce distinct types.

Aliases are transparent in type expressions. For example, if PointTuple is an alias for { Real x; Real y; }, then using PointTuple in a larger type expression has the same denotation as using the structural type expression directly.