comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com (Robert Dewar)
Subject: Re: Elaboration in GNAT
Date: 7 Jan 2002 16:00:49 -0800
Date: 2002-01-08T00:00:49+00:00	[thread overview]
Message-ID: <5ee5b646.0201071600.475f4618@posting.google.com> (raw)
In-Reply-To: 3C39D954.58672C0A@Raytheon.com

Mark Johnson <Mark_H_Johnson@Raytheon.com> wrote in message news:<3C39D954.58672C0A@Raytheon.com>...
> Robert Dewar wrote:
> > 
> > Some things to remember here:
> > 
> > 1. The static elaboration model of GNAT is primarily intended for the development of new code.

> Hmm. I guess I disagree with that statement. See reasons 
> below.

You can't really disagree with the designer of a feature
telling you its primary design intention :-) Of course it
is just fine if it can be used for legacy code, and it is
always good to hear of such successes.

> > 3. If you are working with legacy code, it often makes 
> > no sense to try to use the static model of GNAT

Often /= never! My point, which I guess was confusing was
that it often does not make sense to put in a huge amount
of work to restructure code to meet the static model
 
> Yes and no. Two examples follow.

i.e. you are agreeing, sometimes yes, and sometimes no, 
which is exactly what I was saying

> As Robert's message goes on to say - complicated
> elaboration code is likely filled with bugs anyway. =

That's misreading my message, the bugs I was talking about
are failure to have all the pragma Elaborate's in place, 
but that is very specific.

The paradigm that causes most trouble with the static model
is:

    with X;
    package Y is
       ...
       Q : integer := X.Func;
       ...

where X is a giant package with a large number of with's,
but you happen to know that Func is a little function
that does not use any of these with's. So it is in fact
safe to use pragma Elaborate, instead of pragma Elaborate_All and
everything will work.

The coding philosophy of the static model of GNAT rejects
this coding style on the grounds that it is improper for
a client of X to know anything about the implementation
of the body of X (and any of its subprogram). Yes, that's
a legitimate coding philosophy, but that does not mean that
any code that does not follow this philosophy is buggy :-)

That being said, any program which does a lot of computation at
elaboration time is worrisome. That's
especially so if you have library tasks, which can
start up before elaboration is complete :-( (see special
section on elaboration and tasking in the GNAT docs).

Robert Dewar



  reply	other threads:[~2002-01-08  0:00 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 [this message]
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
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