concept-types.tex 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. % -*- Mode: TeX -*-
  2. % At Barmar's suggestion, and by consensus of Quinquevirate, the type hierarchy
  3. % diagrams, which were quite hard to maintain and anyway unnecessary, were removed.
  4. % The removed text is in
  5. % Stony-Brook.SCRC.Symbolics.COM:>ANSI-CL>spec>archive>source>type-hierarchy-diagrams.tex
  6. % -kmp 10-Jun-91
  7. \beginsubSection{Data Type Definition}
  8. %% No longer true.
  9. %Following is a description of each \clisp\ \term{type}.
  10. % %This kind of info belongs in the descriptions of the ftype{...} labels.
  11. % %New. -kmp
  12. % % Barmar: Relate to the use of "Type" vs "System Class" in following descriptions.
  13. % % Barrett: Perhaps safer to say "Where explicitly noted..."
  14. % % KMP: In fact, I think the paragraph should just disappear, since in all cases where
  15. % % something is both a type and a class, there is a Class Precedence List section
  16. % % in its definition, and the ordering info is already well-defined.
  17. % % Barmar: If there's always a CPL given, then I agree.
  18. %% Removed. -kmp 15-Feb-92
  19. % Except as otherwise noted,
  20. % every \term{symbol} naming a \term{type}
  21. % defined in this specification is also the name of a \term{class} that implements
  22. % the \term{type}. In cases where there is a corresponding \term{class},
  23. % the order of its \term{class precedence list} is consistent with the order
  24. % of the subtype relationships given for the \term{type}.
  25. Information about \term{type} usage is located in
  26. the sections specified in \figref\TypeInfoXrefs.
  27. \figref\ObjectSystemClasses\ lists some \term{classes}
  28. that are particularly relevant to the \CLOS.
  29. \figref\StandardizedConditionTypes\ lists the defined \term{condition} \term{types}.
  30. \DefineFigure{TypeInfoXrefs}
  31. \showtwo{Cross-References to Data Type Information}{
  32. \hfil\b{Section} & Data Type \cr
  33. \noalign{\vskip 2pt\hrule\vskip 2pt}
  34. \secref\Classes & Object System types \cr
  35. \secref\Slots & Object System types \cr
  36. \secref\Objects & Object System types \cr
  37. \secref\GFsAndMethods & Object System types \cr
  38. \secref\ConditionSystemConcepts & Condition System types \cr
  39. \chapref\TypesAndClasses & Miscellaneous types \cr
  40. \chapref\Syntax & All types---read and print syntax \cr
  41. %Nothing really useful here. -kmp 17-Oct-91
  42. %\secref\ReaderConcepts & All types---read syntax \cr
  43. \secref\TheLispPrinter & All types---print syntax \cr
  44. \secref\Compilation & All types---compilation issues \cr
  45. }
  46. %!!! Insert table of Type Specifiers like AND, OR, NOT...
  47. % from top of DICT-TYPES ? -kmp 17-Oct-91
  48. \endsubSection%{Data Type Definition}
  49. \beginsubSection{Type Relationships}
  50. \DefineSection{TypeRelationships}
  51. \beginlist
  52. \issue{DATA-TYPES-HIERARCHY-UNDERSPECIFIED}
  53. \itemitem{\bull}
  54. \Thetypes{cons}, \typeref{symbol}, \typeref{array}, \typeref{number},
  55. \typeref{character}, \typeref{hash-table},
  56. \issue{FUNCTION-TYPE:X3J13-MARCH-88}
  57. \typeref{function},
  58. \endissue{FUNCTION-TYPE:X3J13-MARCH-88}
  59. \typeref{readtable}, \typeref{package}, \typeref{pathname}, \typeref{stream},
  60. \typeref{random-state}, \typeref{condition}, \typeref{restart},
  61. and any single other \term{type} created by \macref{defstruct},
  62. %Added per suggestion of Barrett:
  63. \issue{TYPE-OF-AND-PREDEFINED-CLASSES:UNIFY-AND-EXTEND}
  64. \issue{CLOS-CONDITIONS:INTEGRATE}
  65. \macref{define-condition},
  66. \endissue{CLOS-CONDITIONS:INTEGRATE}
  67. \endissue{TYPE-OF-AND-PREDEFINED-CLASSES:UNIFY-AND-EXTEND}
  68. or \macref{defclass} are \term{pairwise} \term{disjoint},
  69. except for type relations explicitly established by specifying
  70. \term{superclasses} in \macref{defclass}
  71. \issue{TYPE-OF-AND-PREDEFINED-CLASSES:UNIFY-AND-EXTEND}
  72. \issue{CLOS-CONDITIONS:INTEGRATE}
  73. or \macref{define-condition}
  74. \endissue{CLOS-CONDITIONS:INTEGRATE}
  75. \endissue{TYPE-OF-AND-PREDEFINED-CLASSES:UNIFY-AND-EXTEND}
  76. or the \kwd{include} option of \macref{destruct}.
  77. %The following will be left out of the standard.
  78. %% 2.15.0 6
  79. %\itemitem{\bull} \typeref{Cons}, \typeref{symbol},
  80. %\typeref{array}, \typeref{number}, and \typeref{character}
  81. %are \term{pairwise} \term{disjoint}.
  82. \endissue{DATA-TYPES-HIERARCHY-UNDERSPECIFIED}
  83. \issue{DATA-TYPES-HIERARCHY-UNDERSPECIFIED}
  84. %The following will be left out of the standard.
  85. %% 2.15.0 27
  86. %\itemitem{\bull} \typeref{hash-table}, \typeref{readtable},
  87. %\typeref{package}, \typeref{pathname},
  88. %\typeref{stream}, and \typeref{random-state} are
  89. %\term{pairwise} \term{disjoint}.
  90. \endissue{DATA-TYPES-HIERARCHY-UNDERSPECIFIED}
  91. %% 2.15.0 28
  92. \itemitem{\bull} Any two \term{types} created by \macref{defstruct} are
  93. \term{disjoint} unless
  94. one is a \term{supertype} of the other by virtue of
  95. the \macref{defstruct} \kwd{include} option.
  96. \editornote{KMP: The comments in the source say gray suggested some change
  97. from ``common superclass'' to ``common subclass'' in the following, but the
  98. result looks suspicious to me.}
  99. %!!! Barrett says: It fits the glossary definition of disjoint, i.e., no common
  100. % elements. However, I think that is broken.
  101. %
  102. % In places where we have specified disjointness requirements, all we really seem to
  103. % be intendeing is that two types C1 and C2 are disjoint if neither is a subtype of
  104. % the other.
  105. \itemitem{\bull}
  106. Any two \term{distinct} \term{classes} created by \macref{defclass}
  107. % added --sjl 7 Mar 92
  108. or \macref{define-condition}
  109. are \term{disjoint} unless they have a common \term{subclass} or
  110. one \term{class} is a \term{subclass} of the other.
  111. %% The preceding text by Moon replaces the following...
  112. % %% "common superclass" changed to "common subclass" as suggested by Gray
  113. % \itemitem{\bull} Any two \term{classes} created by \macref{defclass}
  114. % are \term{disjoint} unless they have a common \term{subclass} or
  115. % one \term{class} is a \term{superclass} of the other.
  116. % %Any two \term{classes}
  117. % %created by \macref{defclass} are \term{disjoint}
  118. % %unless they have a common \term{superclass}." {That assumes that
  119. % %our definition of superclass says every class is a superclass of
  120. % %itself, which I think is the case, but did not check.}
  121. % %
  122. % %RPG suggestion follows:
  123. % %\itemitem{\bull} Any type created by defstruct or defclass is guaranteed
  124. % %to be disjoint from all other types unless subclass or :include is used.
  125. \issue{COMMON-TYPE:REMOVE}
  126. %The following will be deleted from the standard:
  127. %
  128. %% 2.15.0 29
  129. %\itemitem{\bull} An \term{exhaustive union} for
  130. %\thetype{common} is formed by \typeref{cons}, \typeref{symbol},
  131. %\f{(array x)} where \f{x} is either \typeref{t} or a \term{subtype} of \typeref{common},
  132. %\typeref{string}, \typeref{fixnum}, \typeref{bignum}, \typeref{ratio},
  133. %\typeref{short-float}, \typeref{single-float}, \typeref{double-float}, \typeref{long-float},
  134. %\f{(complex x)} where \f{x} is a \term{subtype} of \typeref{common},
  135. %\typeref{standard-char}, \typeref{hash-table}, \typeref{readtable},
  136. %\typeref{package}, \typeref{pathname},
  137. %\typeref{stream}, \typeref{random-state},
  138. %and all \term{types} created by the user via \macref{defstruct}.
  139. %An implementation cannot add \term{subtypes} to \typeref{common}.
  140. \endissue{COMMON-TYPE:REMOVE}
  141. %% Following is suggested by Moon, rewording of a clause in 88-002R.
  142. \itemitem{\bull}
  143. An implementation may be extended to add other \term{subtype}
  144. relationships between the specified \term{types}, as long as they do
  145. not violate the type relationships and disjointness requirements
  146. specified here. An implementation may define additional \term{types}
  147. that are \term{subtypes} or \term{supertypes} of any
  148. specified \term{types}, as long as each additional \term{type} is
  149. a \subtypeof{t} and a \supertypeof{nil} and the disjointness requirements
  150. are not violated.
  151. \issue{TYPE-OF-AND-PREDEFINED-CLASSES:UNIFY-AND-EXTEND}
  152. At the discretion of the implementation, either \typeref{standard-object}
  153. or \typeref{structure-object} might appear in any class precedence list
  154. for a \term{system class} that does not already specify either
  155. \typeref{standard-object} or \typeref{structure-object}. If it does,
  156. it must precede \theclass{t} and follow all other \term{standardized} \term{classes}.
  157. \endissue{TYPE-OF-AND-PREDEFINED-CLASSES:UNIFY-AND-EXTEND}
  158. \endlist
  159. \endsubSection%{Type relationships}
  160. %% Type Specifiers
  161. \beginsubSection{Type Specifiers}
  162. \DefineSection{TypeSpecifiers}
  163. \issue{ARRAY-TYPE-ELEMENT-TYPE-SEMANTICS:UNIFY-UPGRADING}
  164. %Discussion of difference between "type specifiers for declaration"
  165. %and "type specifiers for discrimination" removed.
  166. \endissue{ARRAY-TYPE-ELEMENT-TYPE-SEMANTICS:UNIFY-UPGRADING}
  167. %% 4.1.0 1
  168. \term{Type specifiers} can be \term{symbols}, \term{classes}, or \term{lists}.
  169. \figref\StandardizedAtomicTypeSpecs\ lists \term{symbols} that are
  170. \term{standardized} \term{atomic type specifiers}, and
  171. \figref\StandardizedCompoundTypeSpecNames\ lists
  172. \term{standardized} \term{compound type specifier} \term{names}.
  173. For syntax information, see the dictionary entry for the corresponding \term{type specifier}.
  174. It is possible to define new \term{type specifiers} using
  175. \macref{defclass},
  176. \macref{define-condition},
  177. \macref{defstruct},
  178. or
  179. \macref{deftype}.
  180. \issue{CHARACTER-VS-CHAR:LESS-INCONSISTENT-SHORT}
  181. \issue{STREAM-ACCESS:ADD-TYPES-ACCESSORS}
  182. \DefineFigure{StandardizedAtomicTypeSpecs}
  183. %% 4.3.0 4
  184. \displaythree{Standardized Atomic Type Specifiers}{
  185. arithmetic-error&function&simple-condition\cr
  186. array&generic-function&simple-error\cr
  187. atom&hash-table&simple-string\cr
  188. base-char&integer&simple-type-error\cr
  189. base-string&keyword&simple-vector\cr
  190. bignum&list&simple-warning\cr
  191. bit&logical-pathname&single-float\cr
  192. bit-vector&long-float&standard-char\cr
  193. broadcast-stream&method&standard-class\cr
  194. built-in-class&method-combination&standard-generic-function\cr
  195. cell-error&nil&standard-method\cr
  196. character&null&standard-object\cr
  197. class&number&storage-condition\cr
  198. compiled-function&package&stream\cr
  199. complex&package-error&stream-error\cr
  200. concatenated-stream&parse-error&string\cr
  201. condition&pathname&string-stream\cr
  202. cons&print-not-readable&structure-class\cr
  203. control-error&program-error&structure-object\cr
  204. division-by-zero&random-state&style-warning\cr
  205. double-float&ratio&symbol\cr
  206. echo-stream&rational&synonym-stream\cr
  207. end-of-file&reader-error&t\cr
  208. error&readtable&two-way-stream\cr
  209. extended-char&real&type-error\cr
  210. file-error&restart&unbound-slot\cr
  211. file-stream&sequence&unbound-variable\cr
  212. fixnum&serious-condition&undefined-function\cr
  213. float&short-float&unsigned-byte\cr
  214. floating-point-inexact&signed-byte&vector\cr
  215. floating-point-invalid-operation&simple-array&warning\cr
  216. floating-point-overflow&simple-base-string&\cr
  217. floating-point-underflow&simple-bit-vector&\cr
  218. }
  219. \endissue{STREAM-ACCESS:ADD-TYPES-ACCESSORS}
  220. \endissue{CHARACTER-VS-CHAR:LESS-INCONSISTENT-SHORT}
  221. \indent
  222. %% 4.2.0 1
  223. If a \term{type specifier} is a \term{list}, the \term{car} of the \term{list}
  224. is a \term{symbol}, and the rest of the \term{list} is subsidiary
  225. \term{type} information. Such a \term{type specifier} is called
  226. a \newterm{compound type specifier}.
  227. Except as explicitly stated otherwise,
  228. the subsidiary items can be unspecified.
  229. The unspecified subsidiary items are indicated
  230. by writing \f{*}. For example, to completely specify
  231. a \term{vector}, the \term{type} of the elements
  232. and the length of the \term{vector} must be present.
  233. \code
  234. (vector double-float 100)
  235. \endcode
  236. The following leaves the length unspecified:
  237. \code
  238. (vector double-float *)
  239. \endcode
  240. The following leaves the element type unspecified:
  241. \code
  242. (vector * 100)
  243. \endcode
  244. Suppose that two \term{type specifiers} are the same except that the first
  245. has a \f{*} where the second has a more explicit specification.
  246. Then the second denotes a \term{subtype}
  247. of the \term{type} denoted by the first.
  248. %% 4.2.0 2
  249. If a \term{list} has one or more unspecified items at the end,
  250. those items can be dropped.
  251. If dropping all occurrences of \f{*} results in a \term{singleton} \term{list},
  252. then the parentheses can be dropped as well (the list can be replaced
  253. by the \term{symbol} in its \term{car}).
  254. For example,
  255. {\tt (vector double-float *)}
  256. can be abbreviated to {\tt (vector double-float)},
  257. and {\tt (vector * *)} can be abbreviated to {\tt (vector)}
  258. and then to
  259. {\tt vector}.
  260. \issue{REAL-NUMBER-TYPE:X3J13-MAR-89}
  261. %Syntax info removed to make the document smaller and more modular. -kmp 20-Oct-91
  262. %Added CONS per Dalton #10 (first public review). -kmp 10-May-93
  263. \DefineFigure{StandardizedCompoundTypeSpecNames}
  264. \displaythree{Standardized Compound Type Specifier Names}{
  265. and&long-float&simple-base-string\cr
  266. array&member&simple-bit-vector\cr
  267. base-string&mod&simple-string\cr
  268. bit-vector&not&simple-vector\cr
  269. complex&or&single-float\cr
  270. cons&rational&string\cr
  271. double-float&real&unsigned-byte\cr
  272. eql&satisfies&values\cr
  273. float&short-float&vector\cr
  274. function&signed-byte&\cr
  275. integer&simple-array&\cr
  276. }
  277. \endissue{REAL-NUMBER-TYPE:X3J13-MAR-89}
  278. \Thenextfigure\ show the \term{defined names} that can be used as
  279. \term{compound type specifier} \term{names}
  280. but that cannot be used as \term{atomic type specifiers}.
  281. \displaythree{Standardized Compound-Only Type Specifier Names}{
  282. and&mod&satisfies\cr
  283. eql&not&values\cr
  284. member&or&\cr
  285. }
  286. %% 4.7.0 1
  287. New \term{type specifiers} can come into existence in two ways.
  288. \beginlist
  289. \itemitem{\bull}
  290. Defining a structure by using \macref{defstruct} without using
  291. the \kwd{type} specifier or defining a \term{class} by using
  292. \macref{defclass}
  293. % added --sjl 7 Mar 92
  294. or \macref{define-condition}
  295. automatically causes the name of the structure
  296. or class to be a new \term{type specifier} \term{symbol}.
  297. \itemitem{\bull}
  298. \macref{deftype} can be used to define \newtermidx{derived type specifiers}{derived type specifier},
  299. which act as `abbreviations' for other \term{type specifiers}.
  300. \endlist
  301. A \term{class} \term{object} can be used as a \term{type specifier}.
  302. When used this way, it denotes the set of all members of that \term{class}.
  303. \Thenextfigure\ shows some \term{defined names} relating to
  304. \term{types} and \term{declarations}.
  305. % I added SUBTYPEP, TYPEP, DEFINE-CONDITION. --sjl 7 Mar 92
  306. \DefineFigure{TypesAndDeclsNames}
  307. \displaythree{Defined names relating to types and declarations.}{
  308. coerce&defstruct&subtypep\cr
  309. declaim&deftype&the\cr
  310. declare&ftype&type\cr
  311. defclass&locally&type-of\cr
  312. define-condition&proclaim&typep\cr
  313. }
  314. \Thenextfigure\ shows all \term{defined names} that are \term{type specifier} \term{names},
  315. whether for \term{atomic type specifiers} or \term{compound type specifiers};
  316. this list is the union of the lists in \figref\StandardizedAtomicTypeSpecs\
  317. and \figref\StandardizedCompoundTypeSpecNames.
  318. \DefineFigure{StandardizedTypeSpecifierNames}
  319. \displaythree{Standardized Type Specifier Names}{
  320. and&function&simple-array\cr
  321. arithmetic-error&generic-function&simple-base-string\cr
  322. array&hash-table&simple-bit-vector\cr
  323. atom&integer&simple-condition\cr
  324. base-char&keyword&simple-error\cr
  325. base-string&list&simple-string\cr
  326. bignum&logical-pathname&simple-type-error\cr
  327. bit&long-float&simple-vector\cr
  328. bit-vector&member&simple-warning\cr
  329. broadcast-stream&method&single-float\cr
  330. built-in-class&method-combination&standard-char\cr
  331. cell-error&mod&standard-class\cr
  332. character&nil&standard-generic-function\cr
  333. class&not&standard-method\cr
  334. compiled-function&null&standard-object\cr
  335. complex&number&storage-condition\cr
  336. concatenated-stream&or&stream\cr
  337. condition&package&stream-error\cr
  338. cons&package-error&string\cr
  339. control-error&parse-error&string-stream\cr
  340. division-by-zero&pathname&structure-class\cr
  341. double-float&print-not-readable&structure-object\cr
  342. echo-stream&program-error&style-warning\cr
  343. end-of-file&random-state&symbol\cr
  344. eql&ratio&synonym-stream\cr
  345. error&rational&t\cr
  346. extended-char&reader-error&two-way-stream\cr
  347. file-error&readtable&type-error\cr
  348. file-stream&real&unbound-slot\cr
  349. fixnum&restart&unbound-variable\cr
  350. float&satisfies&undefined-function\cr
  351. floating-point-inexact&sequence&unsigned-byte\cr
  352. floating-point-invalid-operation&serious-condition&values\cr
  353. floating-point-overflow&short-float&vector\cr
  354. floating-point-underflow&signed-byte&warning\cr
  355. }
  356. \endsubSection%{Type Specifiers}