An opaque type is a name that denotes an unknown subtype of some given
reference type. For example, an opaque subtype of REFANY
is an unknown
traced reference type; an opaque subtype of UNTRACED ROOT
is an unknown
untraced object type. The actual type denoted by an opaque type name is
called its concrete type.
Different scopes can reveal different information about an opaque type. For
example, what is known in one scope only to be a subtype of REFANY
could be known in another scope to be a subtype of ROOT
.
An opaque type declaration has the form:
TYPE T <: Uwhere
T
is an identifier and U
an expression denoting a
reference type. It introduces the name T
as an opaque type and reveals
that U
is a supertype of T
. The concrete type of T
must
be revealed elsewhere in the program.