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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!feeder.eternal-september.org!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!diablo1.news.osn.de!news.osn.de!diablo2.news.osn.de!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed-00.mathworks.com!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Elaboration order handling (Was: Bug in 'gnatmake') Date: Wed, 19 Jun 2013 08:38:21 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <7f33982d-3bcf-452e-a3b3-3a0a28505ff1@x20g2000vbe.googlegroups.com> <87r4g0g9c0.fsf@adaheads.sparre-andersen.dk> <87ip1bg4z2.fsf_-_@adaheads.sparre-andersen.dk> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1371645503 1731 192.74.137.71 (19 Jun 2013 12:38:23 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 19 Jun 2013 12:38:23 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:PGHi2LfS5JagexOz6m9ZirOLWdA= Xref: news.eternal-september.org comp.lang.ada:15828 Date: 2013-06-19T08:38:21-04:00 List-Id: Jeffrey Carter writes: > Elaboration order isn't entirely implementation defined, is it? No, it's not. >...There's > a partial order defined by calls made during elaboration from one pkg to > another. In standard Ada, there's a partial order defined by 'with' clauses, parent/child relationships, and various pragmas. GNAT takes into account calls made during elaboration, but standard Ada does not. And GNAT's rules are necessarily conservative (see Halting Problem). >...Within that ordering there may be groups of pkgs that may be > elaborated in any order after the pkgs that must be elaborated before > them and before the pkgs they must be elaborated before. Within those > groups, why not use lexical order of pkg names? Good idea. ;-) It doesn't solve all the problems with Ada's elaboration model, but it solves the most expensive one (portability). We'd still have the problem that the chosen order can be wrong. And the fact that programmers have to deal with a bunch of kludgy pragmas. And the fact that what should be a compile-time error is a run-time exception. And the fact that the order is global, rather than localized to the children of a single package. Oh, and the fact that the whole model is overly restrictive. For example, it makes perfect sense to say: package Symbols is type Symbol is private; function Intern(S: String) return Symbol; Empty_Symbol: constant Symbol := Intern(""); -- Wrong! But that doesn't work in Ada. It works fine in my hobby language. ;-) - Bob