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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,CP1252 X-Google-Thread: 103376,b1264e586250f470 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-09 18:35:50 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc54.POSTED!not-for-mail Message-ID: <3F0CC2D1.10904@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Elaboration of nested generic package. References: <5437fafb.0307071905.5d3bbc4e@posting.google.com> <1ec946d1.0307080946.7e61cda9@posting.google.com> <5437fafb.0307091710.5cb4b0eb@posting.google.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc54 1057800944 24.62.164.137 (Thu, 10 Jul 2003 01:35:44 GMT) NNTP-Posting-Date: Thu, 10 Jul 2003 01:35:44 GMT Organization: Comcast Online Date: Thu, 10 Jul 2003 01:35:44 GMT Xref: archiver1.google.com comp.lang.ada:40155 Date: 2003-07-10T01:35:44+00:00 List-Id: Don Westermeyer wrote: > 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). This is silly. The reason that Ada doesn't automagically assume Elaborate_Body or Elaborate_All, is that there is a better assumption. The implementation knows the potential elaboration issues and is encouraged to chose one that cannot result in Program_Error. So why then do the pragmas exist? Because it is possible to write programs with several different legal elaboration orders, and it may be either impossible (you can imbed an instance of the Halting Problem) for the compiler to choose the intended elaboration order, or the "correct" elaboration order can depend on something read in at execution time. In either of those two cases, the compiler can tell the programmer, "If you're so smart, you tell me how to do it." But in general, if the compiler can't figure it out, the programmer is very unlikely to have a decent answer in mind. Using pragma Elaborate, Elaborate_All, or Elaborate_Body indiscriminantly can only make the Ada compiler's job harder. There are two exceptions though. If you know that the subprograms declared in a package are used before the main program is elaborated, by all means use Elaborate_All. Also, if you have a package that would not otherwise require a body, pragma Elaborate_Body can insure that a body is required. Otherwise you can get embarrassed if the body is not updated when the specification is changed. -- Robert I. Eachus �In an ally, considerations of house, clan, planet, race are insignificant beside two prime questions, which are: 1. Can he shoot? 2. Will he aim at your enemy?� -- from the Laiden novels by Sharon Lee and Steve Miller.