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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b1264e586250f470 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-09 18:10:31 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dlwester@hotmail.com (Don Westermeyer) Newsgroups: comp.lang.ada Subject: Re: Elaboration of nested generic package. Date: 9 Jul 2003 18:10:31 -0700 Organization: http://groups.google.com/ Message-ID: <5437fafb.0307091710.5cb4b0eb@posting.google.com> References: <5437fafb.0307071905.5d3bbc4e@posting.google.com> <1ec946d1.0307080946.7e61cda9@posting.google.com> NNTP-Posting-Host: 207.191.203.88 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1057799431 14230 127.0.0.1 (10 Jul 2003 01:10:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 10 Jul 2003 01:10:31 GMT Xref: archiver1.google.com comp.lang.ada:40154 Date: 2003-07-10T01:10:31+00:00 List-Id: > > I don't think it matters much what the generic itself says. Whenever > you instantiate a generic package, you should always Elaborate_All on > the with clause: > > with GP; > pragma Elaborate_All (GP); --you need this > > package body Q is > package P is new GP; > end Q; > > See the CLA thread "AQ&S Guidance on pragma Elaborate_Body" which > occurred in 1997/04 -- particularly the responses from Bob Duff and > Robert Dewar. > > I forget whether you need the pragma for root-level instantiations: > > with GP; > pragma Elaborate_All (GP); --needed? > package P is new GP; > > I don't think the pragma inside the generic declaration does very > much, except to indicate to the reader about whether the package uses > named access types, etc. It's the Elaborate_All pragma that's > important for generics. > > Perhaps Bob Duff can, er, elaborate. > > -Matt You should not need an Elaborate_All pragma if the specification contains pragma Elaborate_Body since the body is elaborated immediately after the specification. Using Elaborate_All certainly works also, but a lot of people either forget or more often just don't bother using it. It seems to me using pragmas Pure, Preelaborate, and Elaborate_Body should make usage of a package more fool-proof. When used, they also then to enforce that designers and programmers develop software using non-circular, 'top-down' designs. It seems to me that the Ada language should have assumed an 'Elaborate_All' for every dependancy unless a pragma was used to specifically ignore it. It would seem the compilers should also know when it can ignore elaboration checking without the user specifying Pure or Preelaborate. I'd say most of the people maintaining large Ada projects do not even know the issues of elaboration and how to deal with them. (And it's not like there's a lot of money for training these days.) Usually I do use pragma Elaborate_All for every dependancy anyway since one does not have control over every software module developed. Using it is always safer and causes no penalties that I know of (assuming the design stays clear of mutual dependancies).