Common Lisp the Language, 2nd Edition


next up previous contents index
Next: Scope and Extent Up: Data Types Previous: Unreadable Data Objects

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 through are an exhaustive union of type x if each is a subtype of x, and any object of type x is necessarily of at least one of the types ; through are furthermore an exhaustive partition if they are also pairwise disjoint.

old_change_begin

old_change_end

change_begin
X3J13 voted in June 1988 (DATA-TYPES-HIERARCHY-UNDERSPECIFIED)   to extend the preceding paragraph as follows.

The wording of the first edition was intended to allow implementors to use the defstruct facility to define the built-in types hash-table, readtable, package, pathname, stream, random-state. The change still permits this implementation strategy but forbids these built-in types from including, or being included in, other types (in the sense of the defstruct :include option).

X3J13 voted in June 1988 (FUNCTION-TYPE)   to specify that the type function is disjoint from the types cons, symbol, array, number, and character. The type compiled-function is a subtype of function; implementations are free to define other subtypes of function.
change_end

old_change_begin

old_change_end

change_begin
X3J13 voted in March 1989 (REAL-NUMBER-TYPE)   to rewrite the preceding item as follows.


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.
change_end


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.

old_change_begin


Rationale: It might be thought that fixnum and bignum should form an exhaustive partition of the type integer. This is purposely avoided here in order to permit compatible experimentation with extensions to the Common Lisp integer number system, such as the idea of adding explicit representations of infinity or of positive and negative infinity.

old_change_end

change_begin
X3J13 voted in January 1989 (FIXNUM-NON-PORTABLE)   to specify that the 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.
change_end

old_change_begin

old_change_end

change_begin
X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   to remove the type string-char. The preceding item is replaced by the following.

change_end

old_change_begin

old_change_end

change_begin
X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   to remove the type string-char. The preceding item is replaced by the following.

change_end

old_change_begin

old_change_end

change_begin
X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   to remove the type string-char. The preceding item is replaced by the following.

change_end


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.

change_begin
X3J13 voted in June 1988 (DATA-TYPES-HIERARCHY-UNDERSPECIFIED)   to make random-state, readtable, package, pathname, stream, and hash-table pairwise disjoint from a number of other types as well; see note above.

X3J13 voted in January 1989 (STREAM-ACCESS)   to introduce subtypes of type stream.

change_end

old_change_begin

old_change_end

change_begin
X3J13 voted in March 1989 (COMMON-TYPE)   to remove the type common from the language.
change_end



next up previous contents index
Next: Scope and Extent Up: Data Types Previous: Unreadable Data Objects


AI.Repository@cs.cmu.edu