comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com (Robert Dewar)
Subject: Re: Elaboration in GNAT
Date: 11 Jan 2002 11:18:49 -0800
Date: 2002-01-11T19:18:50+00:00	[thread overview]
Message-ID: <5ee5b646.0201111118.7c513537@posting.google.com> (raw)
In-Reply-To: wcck7up80yy.fsf@shell01.TheWorld.com

Robert A Duff <bobduff@shell01.TheWorld.com> wrote in message news:<wcck7up80yy.fsf@shell01.TheWorld.com>...
> dewar@gnat.com (Robert Dewar) writes:
> 
> > I understand that this is theoretically true, but in practice with
> > GNAT's static model problems do not arise.
> > We have not had one customer using the static model ever
> > run into any elaboration problems at all.
> 
> I skept.  That is, I think you should say, "We have not had one customer
> REPORT TO US ...."  :-)


Well as a competitor (who does not have this capability)
you may of course skept :-) :-)

But our supported customers are not shy about telling us
if they have any problems!

There is one kind of order of elaboration problem that
cannot be dealt with in any automatic manner, and is in
a sense completely outside the elaboration model, and that
is the situation in which the order of elaboration is
important not because of access-before-elaboration issues
(which is what the GNAT model is all about) but because of
other issues.

Consider a library declaration that says:

   x : integer := y.z;

where in package y there is

   y : integer := 35;

Now some other package z which has no elaboration relationship to x
whatsoever (i.e. it is not with'ed
by x and does no with x, directly or indirectly) has
a package body that says:

   y.z := 42;

Now the question is whether x gets initialized to 35 or
42, and that of course depends on when package z is 
elaborated. Either answer might be the intended "right"
one, and there is no clue in the sources at ALL about which
of these is right, so neither choice is better than the
other.

Naturally, GNAT has nothing to say about this issue (and
perhaps that is where Bob's "skept" comes from).

Note that even the Ada language is uncomfortable here, there is no way
for package x to demand that z be elaborated after itself, and even if
the desire is to
have it elaborated before, it is junky to have to add
a with for z just so that it can be mentioned in a pragma
Elaborate.

For a more complete description of this problem, see the
section "Other Elaboration Order Considerations" in the
GNAT users guide.

Actually the history of this section is interesting. We
thought at one time that we had a customer who had run into
this situation, but it turns out that it was something else, but still
it seemed worth generating the special section in the manual on this.

But the bottom line here is that elaboration has proved a
big issue for code using the dynamic elaboration model in
GNAT, in particular legacy code with missing pragma Elaborates, but
once the static model has been satisfied,
elaboration disappears as a significant issue in practice.
That's based on a lot of experience in working with hundreds of
million lines of legacy code from our customers.



  reply	other threads:[~2002-01-11 19:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-28 12:34 Elaboration in GNAT Frode Tenneboe
2001-11-28 18:13 ` Mark Johnson
2001-11-29  3:44   ` Robert Dewar
2001-11-29 13:30     ` Stephen Leake
2001-11-28 19:25 ` Robert Dewar
2002-01-04 13:21   ` Frode Tenneboe
2002-01-04 15:07     ` Matthew Heaney
2002-01-05  0:43       ` Robert Dewar
2002-01-05  0:50       ` Robert Dewar
2002-01-07 17:22         ` Mark Johnson
2002-01-08  0:00           ` Robert Dewar
2002-01-10 21:54         ` Robert A Duff
2002-01-11  4:49           ` Robert Dewar
2002-01-11 13:35             ` Robert A Duff
2002-01-11 19:18               ` Robert Dewar [this message]
2002-01-16 11:48           ` Arnaud Charlet
2002-01-05  0:40     ` Robert Dewar
2002-01-07 13:28       ` Frode Tenneboe
2002-01-11 19:25         ` Robert Dewar
2001-11-29 13:13 ` Stephen Leake
2001-11-29 13:17 ` Stephen Leake
2001-11-30 12:44   ` Simon Wright
replies disabled

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