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,88e7ef9008757431 X-Google-Attributes: gid103376,public From: "Robert I. Eachus" Subject: Re: Function Calls by Address Date: 1999/09/22 Message-ID: <37E9106F.72E3B948@mitre.org>#1/1 X-Deja-AN: 528301744 Content-Transfer-Encoding: 7bit References: <37CADE68.6AF06F5D@escmail.orl.lmco.com> <37CEEFFA.7D73F78D@magic.fr> <7qooh7$hbh$1@nnrp1.deja.com> <37CFFEA6.921CBE59@magic.fr> <37D03AA4.D26CF868@pwfl.com> <37DEB6F2.4DF91D2E@mitre.org> <37E81079.CC2566D9@mitre.org> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.mitre.org X-Trace: top.mitre.org 938020694 3653 129.83.41.77 (22 Sep 1999 17:18:14 GMT) Organization: The MITRE Corporation Mime-Version: 1.0 NNTP-Posting-Date: 22 Sep 1999 17:18:14 GMT Newsgroups: comp.lang.ada Date: 1999-09-22T17:18:14+00:00 List-Id: Robert A Duff wrote: > I don't understand the elaboration order issue. The rules are that the > elaboration or is *exactly* as if you move all the with_clauses from the > subunits up to the containing library unit. So that part is easy. I finally see what you are talking about. Subunits allow you to create a program which will raise Program_Error or some other exception at run-time. Of course you can use pragma Suppress(Elaboration_Check) to prevent this where you KNOW that the elaboration rules are too conservative, but I don't recommend this. Or you could complete all your work before the main program is called... However, in Ada there are usually many legal compilation orders for such programs--if subunits are used to minimize the number of with_clauses on any unit. Now assume you need to do maintenance on a program that is near the edge, or more likely you are reusing such software. If elaboration checks were done at compile time, you would have a great deal of difficulty making the changes. (In other languages you could make the changes, but with no assurance that the result would run correctly.) Almost any change would require recompiling everything. The net result would be that programs which do a lot of work during elaboration were difficult to build and maintain. Using subunits can simplify this process greatly, and were often used that way in Ada 83. However, as Bob Duff points out, with child units now available in Ada 95 there is no need to use subunits this way. Subunits still can be used to minimize the amount of code to be recompiled, but compilers are getting faster, and private child units can often accomplish the same effect. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...