From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!convex!killer!ames!pasteur!ucbvax!TL-20B.TARTAN.COM!GROVER From: GROVER@TL-20B.TARTAN.COM (Vinod Grover) Newsgroups: comp.lang.ada Subject: Elaboration of Library Units Message-ID: <8810261617.AA20823@ajpo.sei.cmu.edu> Date: 26 Oct 88 16:21:52 GMT Article-I.D.: ajpo.8810261617.AA20823 Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: fred@cs.utexas.edu writes > > [example omitted] > > 10.1.2 leads me to believe that package A is elaborated twice; > my compiler says once; 10.5 is obscure. LRM 10.1.2 does not specify a general program transformation, where local packages can be turned into library level packages. LRM 10.1.2 (8) notes that: "the package STOCK has no visibility of outer identifiers other than the predefined identifiers (of package STANDARD). In partcular, STOCK does not use any identifier defined in PROCESSOR ...; otherwise STOCK could not have been extracted from PROCESSOR." If this transformation was to be generally valid, then each library unit would be elaborated as many times as mentioned in with clauses of the transitive closure of the main program. As far the elaboration is concerned, several facts are important. LRM 10.1 (4) says: "for the visibility rules, each library unit acts as a declaration that occurs immediately within the package STANDARD." LRM 10.3 (1) says: "The rules defining the order in which units can be compiled are direct consequences of the visibilty rules and, in particular, of the fact that any library unit that is mentioned by the context clause of a compilation unit is visible in the compilation unit." LRM 10.3 (4) says that: "The order in which compilation units of a program are compiled must be consistent with the partial ordering defined by the above rules". Deducing from these statements, I believe that the order of "declaration" of the library units in the package STANDARD must be consistent with the partial ordering defined by the compilation order, which in turn depends on the visibility rules required (LRM 10.3 (1)). We know from LRM 10.3 (4) that each library unit acts as a single declaration in package STANDARD. Thus this declartion must be elaborated once. And the sequence of the elaboration is consistent with the implicit declaration of these library units in STANDARD. This is summed up in LRM 10.5 (2) "The elaboration of these library units and of the corresponding library unit bodies is performed in an order consistent with this partial ordering defined by the with clauses (see 10.3)." Thus your compiler is correct in elaborating library units once. --- Vinod Grover (Grover@tl-20b.tartan.com) Tartan Labs. Pittsburgh, PA 15213 (412)-621-2210 -------