2.15 Overlap, Inclusion, and Disjointness of Types

The Common Lisp data type hierarchy is tangled and purposely left somewhat open-ended so that implementors may experiment with new data types as extensions to the language. This section explicitly states all the defined relationships between types, including subtype/supertype relationships, disjointness, and exhaustive partitioning. The user of Common Lisp should not depend on any relationships not explicitly stated here. For example, it is not valid to assume that because a number is not complex and not rational that it must be a float, because implementations are permitted to provide yet other kinds of numbers.

First we need some terminology. If x is a supertype of y, then any object of type y is also of type x, and y is said to be a subtype of x. If types x and y are disjoint, then no object (in any implementation) may be both of type x and of type y. Types a1 through an are an exhaustive union of type x if each aj is a subtype of x, and any object of type x is necessarily of at least one of the types aj; a1 through an are furthermore an exhaustive partition if they are also pairwise disjoint.

___________________________________________________________

Rationale: It might be thought that real and complex should form an exhaustive partition of the type number. This is purposely avoided here in order to permit compatible experimentation with extensions to the Common Lisp number system.

___________________________________________________________________________________________________________ __

Rationale: It might be thought that rational and float should form an exhaustive partition of the type real. This is purposely avoided here in order to permit compatible experimentation with extensions to the Common Lisp number system.

___________________________________________________________________________________________________________ _________

Rationale: It might be thought that integer and ratio should form an exhaustive partition of the type rational. This is purposely avoided here in order to permit compatible experimentation with extensions to the Common Lisp rational number system.

___________________________________________________________________________________________________________

Types fixnum and bignum do in fact form an exhaustive partition of the type integer; more precisely, they voted to specify that the type bignum is by definition equivalent to (and integer (not fixnum)). This is consistent with the first edition text in section 2.1.1.

I interpret this to mean that implementators could still experiment with such extensions as adding explicit representations of infinity, but such infinities would necessarily be of type bignum.

____________________________________________________

Rationale: The hypothetical name simple-general-vector would have been more accurate than simple-vector, but in this instance euphony and user convenience were deemed more important to the design of Common Lisp than a rigid symmetry.

___________________________________________________________________________________________________________

random-state, readtable, package, pathname, stream, and hash-table are pairwise disjoint from a number of other types as well; see note above.