home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / lrm / chap10.err < prev    next >
Encoding:
Text File  |  1988-05-03  |  9.0 KB  |  200 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                            Errata for changes to Chapter 10 version 21
  7.  
  8.  
  9.  
  10.  
  11. 10.1  Compilation Units - Library Units (paragraph 6)10.1  Compilation Units - Library Units (paragraph 6)10.1  Compilation Units - Library Units (paragraph 6)
  12.  
  13.  
  14. A subprogram body given in a compilation unit is interpreted as a secondary unit  if  the  program
  15. library  already  contains  a  library  unit  with  the  name  of the subprogram;  it is otherwise
  16. interpreted both as a library unit and as the corresponding library  unit  body  (that  is,  as  a
  17. secondary unit).
  18.  
  19.  
  20.  
  21.  
  22. 10.1  Compilation Units - Library Units (paragraph 11)10.1  Compilation Units - Library Units (paragraph 11)10.1  Compilation Units - Library Units (paragraph 11)
  23.  
  24.  
  25. References:___________
  26.  
  27.  
  28.           allow 1.6, context clause 10.1.1, declaration 3.1, designator 6.1, environment
  29.           10.4,  generic  declaration  12.1,  generic  instantiation  12.3,  hiding 8.3,
  30.           identifier 2.3, library unit 10.5, local declaration 8.1, must 1.6, name  4.1,
  31.           occur  immediately  within 8.1, operator 4.5, operator symbol 6.1, overloading
  32.           6.6 8.7, package body 7.1, package declaration 7.1, parameter of a  subprogram
  33.           6.2,  pragma  2.8,  procedure  6.1,  program unit 6, proper body 3.9, renaming
  34.           declaration  8.5,  simple  name  4.1,  standard  package  8.6,  subprogram  6,
  35.           subprogram  body  6.3,  subprogram  declaration  6.1,  subunit  10.2,  task 9,
  36.           visibility 8.3
  37.  
  38.  
  39.  
  40.  
  41. 10.1.1  Context Clauses - With Clauses (paragraph 9)10.1.1  Context Clauses - With Clauses (paragraph 9)10.1.1  Context Clauses - With Clauses (paragraph 9)
  42.  
  43.  
  44. The following is an example of a  main  program  consisting  of  a  single  compilation  unit:   a
  45. procedure for printing the real roots of a quadratic equation.  The predefined package TEXT_IO and
  46. a  user-defined  package  REAL_OPERATIONS  (containing  the definition of the type REAL and of the
  47. packages REAL_IO and REAL_FUNCTIONS) are assumed to be already present  in  the  program  library.
  48. Such packages may be used by other main programs.
  49.  
  50.  
  51.  
  52.  
  53. 10.1.1  Context Clauses - With Clauses (paragraph 11)10.1.1  Context Clauses - With Clauses (paragraph 11)10.1.1  Context Clauses - With Clauses (paragraph 11)
  54.  
  55.  
  56. The  with  clauses  of a compilation unit need only mention the names of those library subprograms
  57. and packages whose visibility is actually necessary within the unit.  They need  not  (and  should
  58. not)  mention  other  library  units  that are used in turn by some of the units named in the with
  59. clauses, unless these other library units are also used directly by the current compilation  unit.
  60. For  example,  the  body of the package REAL_OPERATIONS may need elementary operations provided by
  61. other packages.  The latter packages should not be named by the with clause of  QUADRATIC_EQUATION
  62. since these elementary operations are not directly called within its body.
  63.  
  64.  
  65.  
  66.  
  67. -1                                            Context Clauses - With Clauses (paragraph 11) 10.1.1
  68.  
  69.  
  70.  
  71.  
  72. 10.2  Subunits of Compilation Units (paragraphs 3 4)10.2  Subunits of Compilation Units (paragraphs 3 4)10.2  Subunits of Compilation Units (paragraphs 3 4)
  73.  
  74.  
  75. A  body  stub is only allowed as the body of a program unit (a subprogram, a package, a task unit,
  76. or a generic unit) if the body stub occurs  immediately  within  either  the  specification  of  a
  77. library package or the declarative part of another compilation unit.
  78.  
  79. If  the  body  of  a  program  unit  is  a body stub, a separately compiled subunit containing the
  80. corresponding proper body is required.  In the case of a subprogram, the subprogram specifications
  81. given in the proper body and in the body stub must conform (see 6.3.1).
  82.  
  83.  
  84.  
  85.  
  86. 10.2.1  Examples of Subunits (paragraph 9)10.2.1  Examples of Subunits (paragraph 9)10.2.1  Examples of Subunits (paragraph 9)
  87.  
  88.  
  89. In the above example TRANSFORM and FACILITY are subunits of TOP, and G is a subunit  of  FACILITY.
  90. The  visibility  in the split version is the same as in the initial version except for one change:
  91. since TEXT_IO is only used within G, the corresponding with clause is written for G instead of for
  92. TOP.  Apart from this change, the same identifiers are visible at corresponding program points  in
  93. the  two  versions.   For  example, all of the following  are (directly) visible within the proper
  94. body of the subunit G:  the procedure TOP, the type REAL, the  variables  R  and  S,  the  package
  95. FACILITY and the contained named number PI and subprograms F and G.
  96.  
  97.  
  98.  
  99.  
  100. 10.3  Order of Compilation (paragraphs 3 4)10.3  Order of Compilation (paragraphs 3 4)10.3  Order of Compilation (paragraphs 3 4)
  101.  
  102.  
  103. If  any  error  is  detected  while  attempting  to compile a compilation unit, then the attempted
  104. compilation is rejected and it has no effect whatsoever on the program library;   the  same  holds
  105. for recompilations (no compilation unit can become obsolete because of such a recompilation).
  106.  
  107. The  order  in  which  the compilation units of a program are compiled must be consistent with the
  108. partial ordering defined by the above rules.
  109.  
  110.  
  111.  
  112.  
  113. 10.3  Order of Compilation (paragraph 16)10.3  Order of Compilation (paragraph 16)10.3  Order of Compilation (paragraph 16)
  114.  
  115.  
  116. For library packages, it follows from the recompilation rules that a package body is made obsolete
  117. by the recompilation of the corresponding specification.  If the new package specification is such
  118. that a package body is not required (that is, if the package specification does  not  contain  the
  119. declaration of a program unit), then the recompilation of a body for this package is not required.
  120. In  any  case,  the  obsolete  package body must not be used and can therefore be deleted from the
  121. program library.
  122.  
  123.  
  124.  
  125.  
  126. 10.4  The Program Library (paragraphs 1 2)10.4  The Program Library (paragraphs 1 2)10.4  The Program Library (paragraphs 1 2)
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. 10.3 Order of Compilation (paragraph 16)                                                        -2
  134.  
  135.  
  136.  
  137.  
  138. Compilers are required to enforce the language rules in the same manner for a  program  consisting
  139. of  several  compilation  units (and subunits) as for a program submitted as a single compilation.
  140. Consequently, a library file containing information  on  the  compilation  units  of  the  program
  141. library must be maintained by the compiler or compiling environment.  This information may include
  142. symbol tables and other information  pertaining to the order of previous compilations.
  143.  
  144. A normal submission to the compiler consists of the compilation unit(s) and the library file.  The
  145. latter is used for checks and is updated for each compilation unit successfully compiled.
  146.  
  147.  
  148.  
  149.  
  150. 10.5  Elaboration of Library Units (paragraph 2)10.5  Elaboration of Library Units (paragraph 2)10.5  Elaboration of Library Units (paragraph 2)
  151.  
  152.  
  153. The  elaboration  of these library units and of the corresponding library unit bodies is performed
  154. in an order consistent with the partial ordering defined by  the  with  clauses  (see  10.3).   In
  155. addition,  a  library  unit mentioned by the context clause of a subunit must be elaborated before
  156. the body of the ancestor library unit of the subunit.
  157.  
  158.  
  159.  
  160.  
  161. 10.6  Program Optimization (paragraph (1)10.6  Program Optimization (paragraph (1)10.6  Program Optimization (paragraph (1)
  162.  
  163.  
  164. Optimization of the elaboration of declarations and the execution of statements may  be  performed
  165. by  compilers.   In particular, a compiler may be able to optimize a program by evaluating certain
  166. expressions, in addition to those that are static expressions.  Should one of  these  expressions,
  167. whether  static or not, be such that an exception would be raised by its evaluation, then the code
  168. in that path of the program can be replaced by code to raise the exception;  the  same  holds  for
  169. exceptions raised by the evaluation of names and simple expressions.  (See also section 11.6.)
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. -3                                                        Program Optimization (paragraph (1) 10.6
  200.