comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <matsw@mail.com>
Subject: Re: generic package dilemma
Date: 1999/11/19
Date: 1999-11-19T08:56:39+00:00	[thread overview]
Message-ID: <383510EA.9DFEE8B6@mail.com> (raw)
In-Reply-To: 383442e1_1@news1.prserv.net

Matthew Heaney wrote:
> 
> In article <3833F615.5AD7166C@mail.com> , Mats Weber <matsw@mail.com>
> wrote:
> 
> > It does: if the generic instantiates another generic, e.g.
> >
> > generic package P1 is ...
> >
> > generic package P2 is ...
> >
> > with P1;
> > package body P2 is
> >    package P1I is new P1;
> > end P2;
> 
> But isn't this wrong?  Shouldn't P2 elaborate P1?
> 
> with P1;
> pragma Elaborate (P1);
> 
> package body P2 is
>   package P1I is new P1;
> end P2;

Suppose someone else wrote P2 or is still developping it, and that
person does not use pragma Elaborate. With Elaborate_All, you are safe.

> > The clause
> >
> > with P2;
> > pragma Elaborate(P2);
> >
> > does not guarantee that P1's body gets elaborated.
> 
> Is this still true if P2 does the proper thing, and elaborates P1?

No. I totally agree with Robert Dewar here: never use Elaborate, use
Elaborate_All instead.

Your approach of using Elaborate at each level, besides being hard to
enforce on a large project, puts unnecessary constraints on the
elaboration order: in our example, where P2I instantiates P2
instantiates P1, valid elaboration orders are: P1, P2, P2I and P2, P1,
P2I. You are unnecessarily enforcing the first one with your approach.

I have done an extensive study of the shortcomings of pragma Elaborate
in my thesis at
http://lglwww.epfl.ch/Team/MW/Ada-Extensions/Ada-Extensions.html




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

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-17  0:00 generic package dilemma Riyaz Mansoor
1999-11-17  0:00 ` Matthew Heaney
1999-11-17  0:00   ` Mats Weber
1999-11-17  0:00     ` Matthew Heaney
1999-11-18  0:00       ` Mats Weber
1999-11-18  0:00         ` Matthew Heaney
1999-11-19  0:00           ` Mats Weber [this message]
1999-11-19  0:00             ` Vladimir Olensky
1999-11-19  0:00             ` Matthew Heaney
1999-11-19  0:00               ` Mats Weber
1999-11-22  0:00                 ` Robert Dewar
1999-11-22  0:00                   ` Mats Weber
1999-11-22  0:00                     ` Bryce Bardin
1999-11-23  0:00                     ` Robert Dewar
1999-11-22  0:00                   ` Mats Weber
1999-11-22  0:00                     ` Robert A Duff
1999-11-23  0:00                       ` Robert Dewar
1999-12-01  0:00                       ` Robert I. Eachus
1999-12-01  0:00                         ` Robert I. Eachus
1999-11-22  0:00                   ` Robert A Duff
1999-11-23  0:00                     ` Robert Dewar
1999-11-29  0:00                       ` Robert A Duff
1999-12-01  0:00                         ` Robert Dewar
1999-12-01  0:00                       ` Robert A Duff
1999-12-02  0:00                         ` Mats Weber
1999-12-03  0:00                           ` Robert Dewar
1999-12-03  0:00                             ` Ted Dennison
1999-12-04  0:00                               ` Robert Dewar
1999-12-03  0:00                             ` Robert A Duff
1999-12-06  0:00                               ` Robert Dewar
1999-11-22  0:00                   ` Larry Kilgallen
1999-11-23  0:00                     ` Robert Dewar
1999-11-19  0:00               ` Robert Dewar
1999-11-19  0:00                 ` Robert I. Eachus
1999-11-22  0:00                   ` Robert Dewar
1999-11-22  0:00                     ` Matthew Heaney
1999-11-19  0:00                 ` Matthew Heaney
1999-11-20  0:00                   ` Mats Weber
1999-11-18  0:00       ` Robert A Duff
1999-11-18  0:00         ` Matthew Heaney
1999-11-19  0:00       ` Robert Dewar
1999-11-18  0:00   ` Riyaz Mansoor
1999-11-19  0:00     ` Robert Dewar
1999-11-19  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