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,baa6871d466e5af9 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: AQ&S Guidance on pragma Elaborate_Body Date: 1997/04/22 Message-ID: #1/1 X-Deja-AN: 236634382 References: <528878564wnr@diphi.demon.co.uk> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-04-22T00:00:00+00:00 List-Id: (e-mailed and posted) In article , Matthew Heaney wrote: >In article , bobduff@world.std.com (Robert A >Duff) wrote: > >> generic >> package G1 is ... end G1; >> >> package body G1 is ... end G1; >> >> generic >> package G2 is ... end G2; >> >> with G1; >> package body G2 is >> package Inst_1 is new G1; >> end G2; >> >> with G2; pragma Elaborate(G2); >> package P is >> package Inst_2 is new G2; >> end P; >> >>This will raise Program_Error. > >But isn't G2 supposed to elaborate G1? > >with G1; >pragma Elaborate (G1); <<<--- >package body G2 is > package Inst_1 is new G1; >end G2; No, G2 does not instantiate G1 during its (G2's) elaboration. In fact, G2 doesn't do anything during elaboration, except to record the fact that it has now been elaborated. In the above example, the following elaboration order does not raise P_E: G2 spec G2 body G1 spec G1 body P spec Of course, you can have a convention that calls for putting in unnecessary pragmas Elaborate, such as the one you suggest. (For example, a reasonable convention for Ada 83 was: put pragma Elaborate on everything you "with", unless you can't because of a cycle.) But I thought we were discussing this convention: X should have pragma-Elaborate_All of Y if and only if X calls/instantiates/activates some subprogram/generic/task in Y during X's elaboration (unless Y has Pure, Preelab, or Elab_Body). And you asked, with respect to this convention, whether it should be Elab instead of Elab_Body. >Isn't G2 supposed to take care of it's own business, and make sure G1 is >elaborated? This is analogous to P making sure G2 is elaborated. No, it's not analogous. G2 is instantiated during P's elaboration. G1 is not instantiated during G2's elaboration. - Bob