comp.lang.ada
 help / color / mirror / Atom feed
From: "Wolf-Dieter Heker" <heker@aonix.de>
Subject: Re: Elaboration Order
Date: 1999/11/16
Date: 1999-11-16T00:00:00+00:00	[thread overview]
Message-ID: <FLABtD.MEw@sd.aonix.com> (raw)
In-Reply-To: 80pcdf$7u5$1@nnrp1.deja.com


Robert Dewar <robert_dewar@my-deja.com> schrieb in im Newsbeitrag:
80pcdf$7u5$1@nnrp1.deja.com...
> In article <FL8IuH.677@sd.aonix.com>,
>   "Wolf-Dieter Heker" <heker@aonix.de> wrote:
> > Hence I would suggest that these packages should contain an
> > elaborate_body pragma (except, of course, if the have no
> body). But alas,
> > most programmers - including myself ;-) - do not write these
> pragmas until
> > the get into trouble.
>
> Well then they are not following standard coding guidelines,
> which is to use pragma Pure if possible, and if not possible,
> use pragma Preelaborate, and if not possible use pragma
> Elaborate_Body.

So you say, most packages should have one of these pragmas. I agree. But the
code I have seen so far does NOT contain them. I think that's real life. Do
you agree?

> > The lack of these pragmas is a portability issue.
>
> Of course the static elaboration model of GNAT eliminates this
> portability issue, especially if you follow the ELaborate_All
> guidelines suggested by -gnatwl.
>
> > And isn't it true that if
> > a package body cannnot be elaborated immediately after the
> spec we have
> > generally a doubtful design?
>
> No, it is common to have package bodies that are mutually
> recursive, and there is nothing whatsoever doubtful about
> such a design.

At least in this case, the author of the mutually dependent packages knows
about the fact and is clearly responsible to resolve the elaboration issue.

> > Now my major question: Why didn't the language designers
> choose an approach
> > that would make the standard case easy and provide a pragma
> > defer_elaboration_of_body for those rare cases, where the user
> doesn't want
> > the body elaborated immediately after the spec?
>
> Because they are not so rare
>
> > Is there more reason that
> > just compatibility with the user unfriendly definition of
> > Ada83?
>
> I see nothing especially unfriendly here, and it is not at
> all obvious what the right solution is here. Programs that
> use elaboration sparingly usually have little trouble.

They have little trouble until somebody tries to initialize a variable by a
function call, for example. Then he discovers that a whole system of
packages is incomplete with respect to elaboration pragmas. It is then not
sufficient to do a local change. It affects code that was considered ok
until then.

> THe supposedly user friendly suggestion you give of the defer
> pragma would be a huge pain in the neck and result in piles
> of pragmas for programs that do not need pragmas now.

Didn't you say above that 'following standard coding guidelines' every
package should contain one of the Pure, Preelaborate or Elaborate_Body
pragmas if possible. From that I conclude that the number of pragmas would
not be increased.

>
> Remember you only need elaborate pragmas if you actually call
> routines during elaboration. Your pragma would need to be used
> all over the place even in a program that HAD no elaboratoin
> code at all.
>
> To see an alternative approach, read the chapter on elaboration
> in the GNAT RM.

Can this be viewed online? I am one of those few people who haven't (yet)
installed GNAT.

>
> Sent via Deja.com http://www.deja.com/
> Before you buy.






  reply	other threads:[~1999-11-16  0:00 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-15  0:00 Elaboration Order Wolf-Dieter Heker
1999-11-15  0:00 ` Robert Dewar
1999-11-16  0:00   ` Wolf-Dieter Heker [this message]
1999-11-16  0:00     ` David C. Hoos, Sr.
1999-11-16  0:00     ` Robert Dewar
1999-11-20  0:00       ` Simon Wright
1999-11-22  0:00         ` Robert Dewar
1999-11-23  0:00           ` Mats Weber
1999-11-16  0:00     ` Robert Dewar
1999-11-15  0:00 ` Jean-Pierre Rosen
1999-11-15  0:00   ` Robert Dewar
1999-11-16  0:00     ` Jean-Pierre Rosen
1999-11-20  0:00       ` Simon Wright
     [not found] <314701A1.469D@lfwc.lockheed.com>
1996-03-15  0:00 ` Elaboration order Robert I. Eachus
1996-03-15  0:00   ` Robert Dewar
     [not found] ` <1996Mar14.021345.9856@enterprise.rdd.lmsc.lockheed.com>
     [not found]   ` <314829CD.4FA9@lfwc.lockheed.com>
1996-03-15  0:00     ` Tucker Taft
1996-03-15  0:00       ` Ken Garlington
1996-03-16  0:00     ` Joe Wierzbowski
1996-03-26  0:00       ` AdaWorks
1996-03-26  0:00         ` Robert A Duff
1996-03-26  0:00         ` Robert Dewar
1996-03-26  0:00           ` Robert A Duff
1996-03-26  0:00             ` Robert Dewar
1996-03-16  0:00     ` Ted Dennison
1996-03-26  0:00     ` Laurent Guerby
1996-03-26  0:00       ` Robert A Duff
1996-03-18  0:00 ` Ken Garlington
1996-03-18  0:00 ` Ted Dennison
1996-03-19  0:00 ` Michel Gauthier
1996-03-20  0:00 ` DenReimer
1996-03-20  0:00   ` Norman H. Cohen
1996-03-20  0:00   ` Robert A Duff
1996-03-20  0:00     ` Norman H. Cohen
1996-03-20  0:00       ` Robert Dewar
1996-03-20  0:00   ` Tucker Taft
     [not found] ` <Do8JDv.A2v@world.std.com>
     [not found]   ` <31494143.3825@lfwc.lockheed.com>
1996-03-15  0:00     ` Robert A Duff
     [not found]       ` <EACHUS.96Mar18143219@spectre.mitre.org>
1996-03-18  0:00         ` Robert Dewar
1996-03-18  0:00         ` Robert Dewar
1996-03-19  0:00           ` Ted Dennison
1996-03-20  0:00         ` David Emery
1996-03-18  0:00       ` Norman H. Cohen
1996-03-15  0:00     ` Mark A Biggar
1996-03-18  0:00       ` Ken Garlington
1996-03-19  0:00         ` Chris McKnight
1996-03-21  0:00           ` Ken Garlington
1996-03-19  0:00         ` Norman H. Cohen
1996-03-20  0:00           ` Cordes MJ
1996-03-19  0:00             ` Robert Dewar
1996-03-21  0:00               ` Ken Garlington
1996-03-21  0:00               ` Cordes MJ
1996-03-20  0:00             ` Robert A Duff
1996-03-20  0:00               ` Cordes MJ
1996-03-20  0:00                 ` Robert A Duff
1996-03-22  0:00                   ` Cordes MJ
1996-03-20  0:00                 ` Robert Dewar
1996-03-21  0:00                   ` Ken Garlington
1996-03-23  0:00                 ` JP Thornley
1996-03-25  0:00                   ` Robert Dewar
1996-03-26  0:00                 ` JP Thornley
1996-03-20  0:00   ` Robert I. Eachus
1996-03-22  0:00   ` Robert I. Eachus
1996-03-22  0:00   ` Robert I. Eachus
     [not found] <DoDMLL.1F9@world.std.com>
1996-03-18  0:00 ` Chris McKnight
  -- strict thread matches above, loose matches on Subject: below --
1996-03-18  0:00 Jean-Pierre Rosen
1996-03-21  0:00 ` Ken Garlington
replies disabled

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