comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Elaboration order handling (Was: Bug in 'gnatmake')
Date: Wed, 19 Jun 2013 14:36:42 -0700 (PDT)
Date: 2013-06-19T14:36:42-07:00	[thread overview]
Message-ID: <d8a1e27d-8d3c-4413-95f7-41a2415321ed@googlegroups.com> (raw)
In-Reply-To: <51c218df$0$6623$9b4e6d93@newsspool2.arcor-online.net>

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:
> 
> >> Lexicographic order would work.  Or backwards of that.  Or apply
> 
> >> "rot-13" to the bytes and then do lexicographic order.  ;-)
> 
> > 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 the lexicographical order of the identifiers.
> 
> 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 had been tested suddenly quit working when a programmer decides to change the name of a package, and makes no other change.  That would certainly be a frustrating occurrence.  

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 compiler could elaborate them in one order, and then in a future build, could choose the reverse order for whatever reason it chooses.  Depending on the compiler, 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 internal 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 order.

The more I think about it, the more I think the answer is that the elaboration 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 reason 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 sure 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 declared as "promising not to call anything outside this package".  There would have to be restrictions on dispatching calls and calls through access-to-subprograms.  I'm not sure this would be a feasible solution.  But to me, having 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" seems 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 hobby language.   :-)

                               -- Adam




  reply	other threads:[~2013-06-19 21:36 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 10:57 Range check for type 'Integer' Peter Brooks
2013-06-17 11:23 ` Simon Clubley
2013-06-17 11:54   ` Simon Wright
2013-06-17 12:55   ` Peter Brooks
2013-06-17 13:28     ` Shark8
2013-06-17 13:45       ` Peter Brooks
2013-06-17 21:16         ` Shark8
2013-06-18 10:48     ` Stephen Leake
2013-06-17 12:46 ` Dmitry A. Kazakov
2013-06-17 13:23 ` Bug in 'gnatmake' (Was: Range check for type 'Integer') Jacob Sparre Andersen
2013-06-17 13:32   ` Bug in 'gnatmake' Jacob Sparre Andersen
2013-06-17 16:50   ` Bug in 'gnatmake' (Was: Range check for type 'Integer') Robert A Duff
2013-06-17 19:15     ` Peter Brooks
2013-06-17 21:09       ` Shark8
2013-06-17 21:22       ` Jeffrey Carter
2013-06-18  1:21         ` Peter Brooks
2013-06-18  6:33           ` Jeffrey Carter
2013-06-18  7:29       ` Georg Bauhaus
2013-06-17 18:49   ` Bug in 'gnatmake' Simon Wright
2013-06-18  9:09     ` Elaboration order handling (Was: Bug in 'gnatmake') Jacob Sparre Andersen
2013-06-18 17:09       ` Robert A Duff
2013-06-18 22:52         ` Adam Beneschan
2013-06-19  1:21           ` Jeffrey Carter
2013-06-19 12:38             ` Robert A Duff
2013-06-19 20:43               ` Georg Bauhaus
2013-06-20  0:37                 ` Robert A Duff
2013-06-20 19:56                   ` Georg Bauhaus
2013-06-19 12:22           ` Robert A Duff
2013-06-19 15:46             ` Adam Beneschan
2013-06-19 16:41               ` Robert A Duff
2013-06-19 20:47               ` Georg Bauhaus
2013-06-19 21:36                 ` Adam Beneschan [this message]
2013-06-20  0:57                 ` Robert A Duff
2013-06-20  1:09                   ` Jeffrey Carter
2013-06-20  2:29                     ` Adam Beneschan
2013-06-20  6:08                       ` Jeffrey Carter
2013-06-20 15:11                     ` Robert A Duff
2013-06-21  5:26                       ` Jeffrey Carter
2013-06-21 15:48                         ` Adam Beneschan
2013-06-21 18:35                           ` Jeffrey Carter
2013-06-21 19:10                             ` Robert A Duff
2013-06-21 21:27                               ` Jeffrey Carter
2013-06-21 20:43                             ` Adam Beneschan
2013-06-21 21:44                               ` Jeffrey Carter
2013-06-21 23:47                                 ` Robert A Duff
2013-06-23 14:43                                   ` AdaMagica
2013-06-21 18:58                         ` null declarative parts (was: Re: Elaboration order handling) Robert A Duff
2013-06-21 20:42                           ` null declarative parts Georg Bauhaus
2013-06-20  2:11                   ` Elaboration order handling (Was: Bug in 'gnatmake') Adam Beneschan
2013-06-20 14:44                     ` Robert A Duff
2013-06-20 11:24                   ` G.B.
2013-06-20 15:23                     ` Robert A Duff
2013-06-19 21:00             ` Georg Bauhaus
2013-06-19 22:26             ` Randy Brukardt
2013-06-20  0:31               ` Robert A Duff
2013-06-20 21:36                 ` Randy Brukardt
2013-06-19 13:07         ` Bill Findlay
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox