Types in Theta are grouped into a type hierarchy. Each type can have
several supertypes. At the top of the hierarchy is type "any",
which has no methods and is the supertype of all types.

The type hierarchy is based on the notion of type equality. A type is
always a subtype and also a supertype of itself. The subtype
(supertype) relation is transitive: if T is a subtype of S and S is a
subtype of R, then T is a subtype of R.

"Any" is the only supertype of the built-in types except that a
rich hierarchy is defined for routine types. In particular, no
subtype relation is provided for "record" and "struct" types, e.g.,

record[a: int, b: int, c: int]

is not a subtype of

record[a: int, b: int]

Specifications for user-defined types and user-defined
parameterized types indicate the immediate supertypes
explicitly (9.2). All supertypes must be user-defined
types, except that every user-defined type is automatically a subtype
of "any". All types generated by instantiating a user-defined
parameterized type are similarly subtypes of "any". The Theta
compiler guarantees that subtypes have all the methods of their
supertypes, with compatible signatures (9.2).

Routine type [tex2html_wrap2871] is a subtype of routine type [tex2html_wrap2873] if all the
following conditions are satisfied:

The two
routine types must either both be procedure types or both be iterator
types.

Contravariance of arguments:
They must have the same number of arguments, and in each argument
position, the type of [tex2html_wrap2875]'s argument must be a supertype of the
type of [tex2html_wrap2877]'s argument.

Covariance of results:
If the two routine types are procedure types, they must have the same
number of return results, and the types of [tex2html_wrap2879]'s results must be
subtypes of the types of the corresponding [tex2html_wrap2881] results.

Covariance of yields:
If the two routine types are iterator types, they must have the same
number of yielded results, and the types of [tex2html_wrap2883]'s yielded results
must be subtypes of the types of the corresponding [tex2html_wrap2885] yielded
results.

[tex2html_wrap2887] must not have any exceptions that are not also exceptions
of [tex2html_wrap2889].

Covariance of exception results:
Corresponding exceptions must have the same numbers of results, and in
the corresponding result positions, the type of [tex2html_wrap2891]'s result must
be a subtype of the type of [tex2html_wrap2893]'s result.