[Next] [Previous] [Up] [Top] [Contents] [Index]

5 Types and Classes

The Type Protocol

The type protocol comprises the following:

Base Types and Pseudosubtypes

Every type has a base type. The base type for a class is the class itself. The base type of a singleton is the singleton itself. The base type of a union is the union of the base types of its component types. The base type of a limited type limited(C, ...) is C.

The type t1 is a pseudosubtype of the type t2 if t1 is a subtype of the base type of t2 and t1 and t2 are not disjoint.

Note that t1 being a subtype of t2 implies that t1 is a pseudosubtype of t2, but t1 being a pseudosubtype of t2 does not imply that t1 is a subtype of t2. Note also that if t2 is not a limited type or some other non-standard type, then pseudosubtype is the same as subtype.

Base types and pseudosubtypes are used in the rules for sealing, described in Chapter 9, "Sealing."

Type Disjointness

Informally, two types are disjoint if there can be no object that is an instance of both types. Formally, the disjointness of types is specified by the following set of rules. (Some of these rules reference definitions given in "Limited Integer Types" on page 72, "Element Types" on page 122 and "Limited Collection Types" on page 124.)


Dylan Reference Manual - 17 OCT 1995
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker