concept-conformance.tex 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. %-*- Mode: TeX -*-
  2. %%Compliance
  3. This standard presents the syntax and semantics to be implemented by a
  4. \term{conforming implementation} (and its accompanying documentation).
  5. In addition, it imposes requirements on \term{conforming programs}.
  6. \beginsubSection{Conforming Implementations}
  7. A \newterm{conforming implementation} shall adhere to the requirements outlined
  8. in this section.
  9. \beginsubsubsection{Required Language Features}
  10. \DefineSection{ReqLangFeatures}
  11. A \term{conforming implementation} shall accept all features
  12. (including deprecated features)
  13. of the language specified in this standard,
  14. with the meanings defined in this standard.
  15. A \term{conforming implementation} shall not require the inclusion of substitute
  16. or additional language elements in code in order to accomplish a feature of
  17. the language that is specified in this standard.
  18. \endsubsubsection%{Required Language Features}
  19. \beginsubsubsection{Documentation of Implementation-Dependent Features}
  20. A \term{conforming implementation} shall be accompanied by a document
  21. that provides a definition of all \term{implementation-defined}
  22. aspects of the language defined by this specification.
  23. In addition, a \term{conforming implementation} is encouraged (but not required)
  24. to document items in this standard that are identified as
  25. \term{implementation-dependent}, although in some cases
  26. such documentation might simply identify the item as ``undefined.''
  27. \endsubsubsection%{Documentation of Implementation-Dependent Features}
  28. \beginsubsubsection{Documentation of Extensions}
  29. A \term{conforming implementation} shall be accompanied by a
  30. document that separately describes any features accepted by the
  31. \term{implementation} that are not specified in this standard, but that do not
  32. cause any ambiguity or contradiction when added to the language
  33. standard. Such extensions shall be described as being ``extensions to
  34. \clisp\ as specified by ANSI \metavar{standard number}.''
  35. \endsubsubsection%{Documentation of Extensions}
  36. \beginsubsubsection{Treatment of Exceptional Situations}
  37. A \term{conforming implementation} shall treat exceptional situations
  38. in a manner consistent with this specification.
  39. \beginsubsubsubsection{Resolution of Apparent Conflicts in Exceptional Situations}
  40. If more than one passage in this specification appears to apply to the
  41. same situation but in conflicting ways, the passage that appears
  42. to describe the situation in the most specific way (not necessarily the
  43. passage that provides the most constrained kind of error detection)
  44. takes precedence.
  45. \beginsubsubsubsubsection{Examples of Resolution of Apparent Conflicts
  46. in Exceptional Situations}
  47. Suppose that function \f{foo} is a member of a set $S$ of \term{functions} that
  48. operate on numbers. Suppose that one passage states that an error must be
  49. signaled if any \term{function} in $S$ is ever given an argument of \f{17}.
  50. Suppose that an apparently conflicting passage states that the consequences
  51. are undefined if \f{foo} receives an argument of \f{17}. Then the second passage
  52. (the one specifically about \f{foo}) would dominate because the description of
  53. the situational context is the most specific, and it would not be required that
  54. \f{foo} signal an error on an argument of \f{17} even though other functions in
  55. the set $S$ would be required to do so.
  56. \endsubsubsubsubsection%{Examples of Resolution of Apparent Conflicts
  57. % in Exceptional Situations}
  58. \endsubsubsubsection%{Resolution of Apparent Conflicts in Exceptional Situations}
  59. \endsubsubsection%{Treatment of Exceptional Situations}
  60. \beginsubsubsection{Conformance Statement}
  61. A \term{conforming implementation} shall produce a conformance statement
  62. as a consequence of using the implementation, or that statement
  63. shall be included in the accompanying documentation. If the implementation
  64. conforms in all respects with this standard, the conformance statement
  65. shall be
  66. \beginlist
  67. \item{} ``\metavar{Implementation} conforms with the requirements
  68. of ANSI \metavar{standard number}''
  69. \endlist
  70. If the \term{implementation} conforms with some but not all of the requirements of this
  71. standard, then the conformance statement shall be
  72. \beginlist
  73. \item{} ``\metavar{Implementation} conforms with the requirements of
  74. ANSI \metavar{standard number} with the following exceptions:
  75. \metavar{reference to or complete list of the requirements of
  76. the standard with which the implementation does not conform}.''
  77. \endlist
  78. \endsubsubsection%{Conformance Statement}
  79. \endsubSection%{Conforming Implementations}
  80. \beginsubSection{Conforming Programs}
  81. \idxterm{conforming program}\idxterm{conforming code}
  82. Code conforming with the requirements of this standard shall adhere to the
  83. following:
  84. \beginlist
  85. \itemitem{1.} \term{Conforming code} shall use only those features of the
  86. language syntax and semantics that are
  87. either specified in this standard
  88. or defined using the extension mechanisms
  89. specified in the standard.
  90. %% This biz about syntactic extension seems overly specific for this context. -kmp 23-Oct-91
  91. % (\eg \term{symbol macros},
  92. % \term{macros},
  93. % %%Compiler macros do not extend syntax.
  94. % %%They only provide an alternate implementation of existing syntax. -kmp 11-Mar-91
  95. % %\term{compiler macros},
  96. % and \term{reader macros}).
  97. %% Rewritten per X3J13 and Boyer/Kaufmann/Moore #2 (second public review).
  98. %% -kmp 9-May-94
  99. % \itemitem{2.} \term{Conforming code} shall not rely on any particular
  100. % interpretation of \term{implementation-dependent} features.
  101. \itemitem{2.} \term{Conforming code} may use
  102. \term{implementation-dependent} features and values,
  103. but shall not rely upon
  104. any particular interpretation of these features and values
  105. other than those that are discovered by the execution of \term{code}.
  106. \itemitem{3.} \term{Conforming code} shall not depend on the consequences
  107. of undefined or unspecified situations.
  108. \itemitem{4.} \term{Conforming code} does not use any constructions
  109. that are prohibited by the standard.
  110. \itemitem{5.} \term{Conforming code} does not depend on extensions
  111. included in an implementation.
  112. \endlist
  113. % This material is all covered in more detail in chapter 3 (in the section
  114. % on constraints on externalizable objects). There is no need to repeat
  115. % the material here. --sjl 13 Mar 92
  116. %\beginsubsubsection{Conforming Programs in Files}
  117. %
  118. %A \term{conforming program} whose source text is in a \term{compilation unit}
  119. %must satisfy the following constraints:
  120. %
  121. %\beginlist
  122. %
  123. %\item{\bull}
  124. % Any \term{top level form} in a \term{file} that alters
  125. % \thevalueof{*package*} at compile time must also alter it at load time
  126. % to a \term{similar} \term{package}.
  127. %
  128. %\item{\bull}
  129. % If the first \term{non-atomic} \term{top level form} in the \term{file}
  130. % is not a call to \macref{in-package}, then the \term{current package}
  131. % at load time must be a \term{similar} \term{package} to the one in effect at
  132. % compile time.
  133. %
  134. %\item{\bull}
  135. % Any \term{symbol} in the source text \term{accessible} in the
  136. % \term{current package} at compile time and whose \term{home package}
  137. % is the package $P$ must be \term{accessible} in the \term{current package}
  138. % at load time and must also be \term{accessible} in a package \term{similar} to $P$.
  139. %
  140. %\item{\bull}
  141. % Any \term{symbol} in the source text that is an \term{external symbol}
  142. % of the package $P$ at compile time must be an \term{external symbol}
  143. % of package \term{similar} to $P$ at load time.
  144. %
  145. %\endlist
  146. %
  147. %In \term{situations} in which any of these conditions does not hold,
  148. %an \term{implementation} might signal an error
  149. %or might extend \clisp\ to handle the situation.
  150. %
  151. %\endsubsubsection%{Conforming Programs in Files}
  152. \beginsubsubsection{Use of Implementation-Defined Language Features}
  153. Note that \term{conforming code} may rely on particular
  154. \term{implementation-defined} values or features. Also note that the
  155. requirements for \term{conforming code} and \term{conforming implementations} do not
  156. require that the results produced by conforming code always be the
  157. same when processed by a \term{conforming implementation}. The results may be the
  158. same, or they may differ.
  159. %% Moved to its own section (see below) per Dalton #1 (1st Public Review)
  160. %% by X3J13 vote May 4-5, 1994 (after 2nd public review).
  161. %% -kmp 9-May-94
  162. % %!!! Barmar wonders if this is really the right place for the next sentence.
  163. % \term{Portable code} is written using only \term{standard characters}.
  164. %Informally, the basic rules for conformance are as follows:
  165. %1. Conforming code is defined in terms of its structure,
  166. %and not in terms of its results and side effects.
  167. %2. Conforming code is written using only the syntax specified in the standard,
  168. %or syntax defined using the syntax extension mechanisms (macros and reader
  169. %macros) specified in the standard.
  170. %3. Conforming code is written in only the sequence specified in the standard.
  171. %4. Conforming code is written using only the functions, macros,
  172. %special forms, variables, and constants specified in the standard.
  173. %5. Conforming implementations provide the functionality and behavior
  174. %specified in the standard.
  175. %The definitions of all names and syntax that aren't specified in the
  176. %standard and aren't provided by the implementation must accompany the code.
  177. %6. Conformance is not machine-checkable.
  178. Conforming code may run in all conforming implementations, but might
  179. have allowable \term{implementation-defined} behavior that makes it
  180. non-portable code.
  181. %Insofar as we allow options in the standard this will be true.
  182. For example, the following are examples of \term{forms} that are conforming, but
  183. that might return different \term{values} in different implementations:
  184. \code
  185. (evenp most-positive-fixnum) \EV \term{implementation-dependent}
  186. (random) \EV \term{implementation-dependent}
  187. (> lambda-parameters-limit 93) \EV \term{implementation-dependent}
  188. (char-name #\\A) \EV \term{implementation-dependent}
  189. \endcode
  190. \beginsubsubsubsection{Use of Read-Time Conditionals}
  191. \DefineSection{ReadTimeConditionals}
  192. %The following is added to clarify a question from RWK.
  193. %Mail sent to him and Quinquevirate noting that this interpretation was made.
  194. % -kmp 10-Apr-91
  195. Use of \f{\#+} and \f{\#-} does not automatically disqualify a program
  196. from being conforming. A program which uses \f{\#+} and \f{\#-} is
  197. considered conforming if there is no set of \term{features} in which the
  198. program would not be conforming. Of course, \term{conforming programs} are
  199. not necessarily working programs. The following program is conforming:
  200. \code
  201. (defun foo ()
  202. \#+ACME (acme:initialize-something)
  203. (print 'hello-there))
  204. \endcode
  205. However, this program might or might not work, depending on whether the
  206. presence of the feature \f{ACME} really implies that a function named
  207. \f{acme:initialize-something} is present in the environment. In effect,
  208. using \f{\#+} or \f{\#-} in a \term{conforming program} means that the variable
  209. \varref{*features*}\idxref{*features*}
  210. becomes just one more piece of input data to that
  211. program. Like any other data coming into a program, the programmer
  212. is responsible for assuring that the program does not make unwarranted
  213. assumptions on the basis of input data.
  214. \endsubsubsubsection%{Use of Read-Time Conditionals}
  215. \endsubsubsection%{Use of Implementation-Defined Language Features}
  216. \beginsubsubsection{Character Set for Portable Code}
  217. \term{Portable code} is written using only \term{standard characters}.
  218. \endsubsubsection%{Character Set for Portable Code}
  219. \endsubSection%{Conforming Programs}