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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bdf542b1399c1cbe,start X-Google-Attributes: gid103376,public From: Bill Keen Subject: Elaboration of nested packages. Date: 1997/06/18 Message-ID: #1/1 X-Deja-AN: 249416031 Distribution: world X-NNTP-Posting-Host: marnhull.demon.co.uk [158.152.152.171] Organization: Peninsula Products Newsgroups: comp.lang.ada Date: 1997-06-18T00:00:00+00:00 List-Id: The following piece of code expresses the essence of a problem I am having in an Ada project using Ada83 and an old Alsys cross compiler. I brought the fragment home to exercise it using GNAT 3.07 on DOS, and I am more confused than ever. with Ada.text_io; use Ada.text_io; procedure P is package OP is generic package IG is end IG; end OP; package PI is new OP.IG; -- Is this ok? package body OP is package body IG is begin put_line("Elaborated body IG"); end; begin put_line("Elaborated body OP"); end; begin put_line("Main program"); end P; When I run the program it generates I get: Elaborated body OP Main program If I move the instantiation of OP.IG to below the body of OP the result seems quite logical as it prints: Elaborated body OP Elaborated body IG Main program The first case baffles me. Does it never instantiate IG? The investigation started when I thought in Ada83 this should raise Program_error because of access before elaboration. I haven't run this exact example on the Alsys compiler yet, but similar examples compile and run ok. The LRM(83) 11.1-7 says (of Program_error) "This exception is raised upon an attempt ... to elaborate a generic instantiation if the body of the corresponding unit has not been elaborated." Surely the instantiation of OP.IG qualifies. I can't find a statement corresponding to 11.1-7 in the Ada95 RM. Has the meaning of program_error changed in Ada95? -- Bill Keen