comp.lang.ada
 help / color / mirror / Atom feed
From: dlwester@hotmail.com (Don Westermeyer)
Subject: Re: Elaboration of nested generic package.
Date: 9 Jul 2003 18:10:31 -0700
Date: 2003-07-10T01:10:31+00:00	[thread overview]
Message-ID: <5437fafb.0307091710.5cb4b0eb@posting.google.com> (raw)
In-Reply-To: 1ec946d1.0307080946.7e61cda9@posting.google.com

> 
> I don't think it matters much what the generic itself says.  Whenever
> you instantiate a generic package, you should always Elaborate_All on
> the with clause:
> 
> with GP;
> pragma Elaborate_All (GP);  --you need this
> 
> package body Q is
>    package P is new GP;
> end Q;
> 
> See the CLA thread "AQ&S Guidance on pragma Elaborate_Body" which
> occurred in 1997/04 -- particularly the responses from Bob Duff and
> Robert Dewar.
> 
> I forget whether you need the pragma for root-level instantiations:
> 
> with GP;
> pragma Elaborate_All (GP); --needed?
> package P is new GP;
> 
> I don't think the pragma inside the generic declaration does very
> much, except to indicate to the reader about whether the package uses
> named access types, etc.  It's the Elaborate_All pragma that's
> important for generics.
> 
> Perhaps Bob Duff can, er, elaborate.
> 
> -Matt
You should not need an Elaborate_All pragma if the specification
contains pragma Elaborate_Body since the body is elaborated
immediately after the specification.

Using Elaborate_All certainly works also, but a lot of people either
forget or more often just don't bother using it.  It seems to me using
pragmas Pure, Preelaborate, and Elaborate_Body should make usage of a
package more fool-proof.  When used, they also then to enforce that
designers and programmers develop software using non-circular,
'top-down' designs.

It seems to me that the Ada language should have assumed an
'Elaborate_All' for every dependancy unless a pragma was used to
specifically ignore it.  It would seem the compilers should also know
when it can ignore elaboration checking without the user specifying
Pure or Preelaborate.

I'd say most of the people maintaining large Ada projects do not even
know the issues of elaboration and how to deal with them. (And it's
not like there's a lot of money for training these days.)


Usually I do use pragma Elaborate_All for every dependancy anyway
since one does not have control over every software module developed. 
Using it is always safer and causes no penalties that I know of
(assuming the design stays clear of mutual dependancies).



  reply	other threads:[~2003-07-10  1:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-02  4:13 Elaboration of nested generic package christoph.grein
2003-07-08  3:05 ` Don Westermeyer
2003-07-08 17:46   ` Matthew Heaney
2003-07-10  1:10     ` Don Westermeyer [this message]
2003-07-10  1:35       ` Robert I. Eachus
2003-07-10  4:51         ` Robert I. Eachus
2003-07-10  6:58           ` Jean-Pierre Rosen
2003-07-10 15:08             ` Robert I. Eachus
2003-07-11 21:26             ` Robert A Duff
2003-07-10 14:12         ` Matthew Heaney
2003-07-10 15:39           ` Robert I. Eachus
2003-07-11 21:41           ` Robert A Duff
2003-07-14 18:35             ` Matthew Heaney
2003-07-15 17:19               ` Randy Brukardt
2003-07-16 15:24                 ` Matthew Heaney
2003-07-17  2:08                   ` Randy Brukardt
2003-07-17 15:54                     ` Richard Riehle
2003-07-10 15:03         ` Don Westermeyer
2003-07-10 15:45       ` Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
2003-07-09  5:21 christoph.grein
2003-07-01 20:14 Don Westermeyer
replies disabled

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