From: ncohen@watson.ibm.com (Norman H. Cohen)
Subject: Re: Elaboration order
Date: 1996/03/20
Date: 1996-03-20T00:00:00+00:00 [thread overview]
Message-ID: <4ip8vv$1fv2@watnews1.watson.ibm.com> (raw)
In-Reply-To: 4io8rn$gfn@newsbf02.news.aol.com
In article <4io8rn$gfn@newsbf02.news.aol.com>, denreimer@aol.com (DenReimer)
writes:
|> Here's something that I'm trying to do in Ada83 and Ada95:
|>
|> with GENERIC_PACKAGE;
|> package A_PKG is
|> package INSTANCE is new GENERIC_PACKAGE ( ... );
|> X : INTEGER := INSTANCE.SOME_FUNCTION;
|> end A_PKG;
|>
|> The elaboration of X requires that the instantiated package INSTANCE be
|> elaborated first (both spec and body.) The compiler will not let me use
|> pragma elaborate (INSTANCE);
|>
|> It is not clear to me what the elaboration order should be in the case of
|> nested packages. I would like to assume that for nested packages, the
|> elaboration is also nested. In the case of generic instantiations, both
|> spec and body would be elaborated at the point of instantiation.
|> Unfortunately, the LRM does not seem to make any requirements regarding
|> elaboration order for nested packages.
RM83-7.2(3), RM95-7.1(8): "The elaboration of a package declaration
consists of the elaboration of its basic declarative items in the given
order."
RM83-12.3(17): "For the elaboration of a generic instantiation, ....
Finally, the implicitly generated instance is elaborated."
RM95-12.3(20) is more explicit: "Finally, the instance declaration and
body are elaborated."
Thus both the declaration and body of Instance are sure to be elaborated
before the declaration of X is elaborated.
|> When I use gnat, I get a program error.
Possibly from an attempt to instantiate the TEMPLATE before its GENERIC
BODY has been elaborated. (See RM83-3.9(7), RM95-3.11(13).)
Change your context clause to:
with Generic_Package; pragma Elaborate(Generic_Package);
--
Norman H. Cohen ncohen@watson.ibm.com
next prev parent reply other threads:[~1996-03-20 0:00 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 Dewar
1996-03-26 0:00 ` Robert A Duff
1996-03-26 0:00 ` Robert Dewar
1996-03-26 0:00 ` IO in Pure packages, debugging Laurent Guerby
1996-03-26 0:00 ` Elaboration order Robert A Duff
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 ` Ted Dennison
1996-03-18 0:00 ` Ken Garlington
1996-03-19 0:00 ` Michel Gauthier
[not found] ` <Do8JDv.A2v@world.std.com>
[not found] ` <31494143.3825@lfwc.lockheed.com>
1996-03-15 0:00 ` Robert A Duff
1996-03-18 0:00 ` Norman H. Cohen
[not found] ` <EACHUS.96Mar18143219@spectre.mitre.org>
1996-03-18 0:00 ` Robert Dewar
1996-03-19 0:00 ` Ted Dennison
1996-03-18 0:00 ` Robert Dewar
1996-03-20 0:00 ` David Emery
1996-03-15 0:00 ` Mark A Biggar
1996-03-18 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-19 0:00 ` Chris McKnight
1996-03-21 0:00 ` Ken Garlington
1996-03-20 0:00 ` Robert I. Eachus
1996-03-22 0:00 ` Robert I. Eachus
1996-03-22 0:00 ` Robert I. Eachus
1996-03-20 0:00 ` DenReimer
1996-03-20 0:00 ` Tucker Taft
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 ` Norman H. Cohen [this message]
[not found] <DoDMLL.1F9@world.std.com>
1996-03-18 0:00 ` Chris McKnight
1996-03-18 0:00 Jean-Pierre Rosen
1996-03-21 0:00 ` Ken Garlington
-- strict thread matches above, loose matches on Subject: below --
1999-11-15 0:00 Elaboration Order Wolf-Dieter Heker
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
1999-11-15 0:00 ` Robert Dewar
1999-11-16 0:00 ` Wolf-Dieter Heker
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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox