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 X-Received: by 10.224.86.200 with SMTP id t8mr5055012qal.0.1371677803493; Wed, 19 Jun 2013 14:36:43 -0700 (PDT) X-Received: by 10.50.127.231 with SMTP id nj7mr1033402igb.17.1371677803297; Wed, 19 Jun 2013 14:36:43 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!bw2no2338456qab.0!news-out.google.com!y6ni3510qax.0!nntp.google.com!j2no872471qak.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 19 Jun 2013 14:36:42 -0700 (PDT) In-Reply-To: <51c218df$0$6623$9b4e6d93@newsspool2.arcor-online.net> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ NNTP-Posting-Host: 66.126.103.122 References: <7f33982d-3bcf-452e-a3b3-3a0a28505ff1@x20g2000vbe.googlegroups.com> <87r4g0g9c0.fsf@adaheads.sparre-andersen.dk> <87ip1bg4z2.fsf_-_@adaheads.sparre-andersen.dk> <53d0b070-a03b-43d0-a560-68dd3a8bebf5@googlegroups.com> <51c218df$0$6623$9b4e6d93@newsspool2.arcor-online.net> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Elaboration order handling (Was: Bug in 'gnatmake') From: Adam Beneschan Injection-Date: Wed, 19 Jun 2013 21:36:43 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Original-Bytes: 4764 Xref: number.nntp.dca.giganews.com comp.lang.ada:181964 Date: 2013-06-19T14:36:42-07:00 List-Id: On Wednesday, June 19, 2013 1:47:29 PM UTC-7, Georg Bauhaus wrote: > On 19.06.13 17:46, Adam Beneschan wrote: > > On Wednesday, June 19, 2013 5:22:30 AM UTC-7, Robert A Duff wrote: >=20 > >> Lexicographic order would work. Or backwards of that. Or apply >=20 > >> "rot-13" to the bytes and then do lexicographic order. ;-) >=20 > > I guess it could work, but I gotta tell you--that seems really weird. = I've never heard of another language where the semantics could depend on th= e lexicographical order of the identifiers. >=20 > Having had to live with products of programmers favoring symbolic > cleverness, I naturally think of what happens when some project > depend on lexicographical order and then someone wishes to give > packages different names. ARGH! Yeah, I thought about that. It would seem strange to have a program that h= ad been tested suddenly quit working when a programmer decides to change th= e name of a package, and makes no other change. That would certainly be a = frustrating occurrence. =20 On the other hand, the current situation isn't any better. If you have two= packages whose elaboration order isn't defined by the language, the compil= er could elaborate them in one order, and then in a future build, could cho= ose the reverse order for whatever reason it chooses. Depending on the com= piler, changing the name of a package could cause that to happen, if (say) = that causes an old package name to be removed from the middle of some inter= nal list and then inserted at the end of the list with the new name, which = could cause a difference in how the compiler determines the elaboration ord= er. The more I think about it, the more I think the answer is that the elaborat= ion of library package P should just be prohibited from calling subprograms= in another package Q, or accessing variables declared in Q's specification= , unless there is an Elaborate(_All) pragma, or unless there's some other r= eason Q must be elaborated before P (e.g. P's *specification* says "with Q"= ), or Q is Pure, or perhaps some other things. Writing the rules to make s= ure this happens wouldn't be easy. It probably means that P's elaboration = code also can't call a subprogram in P unless that subprogram is also decla= red as "promising not to call anything outside this package". There would = have to be restrictions on dispatching calls and calls through access-to-su= bprograms. I'm not sure this would be a feasible solution. But to me, hav= ing the language defined so that "if the elaboration order is undefined, we= 'll put restrictions on things so that the order can't possibly matter" see= ms better, theoretically, than coming up with some unnatural order just so = that we can say "something is defined". That's just my gut feeling. Since= I doubt anyone is really going to think about adding this to Ada, all this= is hypothetical until Bob decides to finally define and implement his hobb= y language. :-) -- Adam