The Avail Programming Language

Subtype & Supertype

With two types X and Y, Y is a subtype of X when Y is the same as, or more specific than, X. Then X is a supertype of Y because X is the same as, or more general than, Y.

Example: The type whole number is a subtype of integer because all whole numbers are also integers. But not all integers are whole numbers: integers that are less than 0 are integers but not whole numbers. In this relationship, whole number is the subtype, and integer is the supertype.

The subtype/supertype relationship can be tested by running the Boolean-returning methods "_⊆_" and "_⊇_". In the first method, the suspected subtype is passed as the left-hand argument, and the suspected supertype as the right-hand argument. For the second method, the argument positions are switched. Note that the characters used to establish the subtype/supertype relationships are the Unicode "subset of or equal to" and "superset of or equal to" characters. This is because Avail types are sets, and entities acquire type membership by meeting the characteristics of a member of the set.

See also: Proper Subtype & Supertype