comp.lang.ada
 help / color / mirror / Atom feed
From: mark.biggar@trustedsyslabs.com
Subject: Re: (generic) child package of generic package; intantiation of
Date: Mon, 29 Jan 2001 17:24:24 GMT
Date: 2001-01-29T17:24:24+00:00	[thread overview]
Message-ID: <9548vr$32h$1@nnrp1.deja.com> (raw)
In-Reply-To: LUgd6.9728$Qb7.1473404@newsb.telia.net

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]

In article <LUgd6.9728$Qb7.1473404@newsb.telia.net>,
  "Peter Hend�n" <phenden@tdab.com> wrote:
> I have the following:
>
> generic
>     Count : in Natural := 1;
> package Parent is
>     ...
> end Parent;
>
> generic
> package Parent.RarelyUsedOps is
>     ...
> end Parent.RarelyUsedOps;
>
> I have no problem instantiating Parent, of course, but how in the name
of Ms
> Lovelace do I instantiate the child package?

with Parent;
package p is new Parent;

with P.RarelyUsedOps;
package P.R is new P.RarelyUsedOps;

When you instantiate a generic package that has generic children
the newly created package automaticaly gets partialy instantiated
generic children that correspond to the generic children of the
original generic package.  In a lot of way the children of a package
work as if they were directly imbeded in the parent package.  If
you example instead was:

generic
     Count : in Natural := 1;
package Parent is
     ...

generic
package Parent.RarelyUsedOps is
    ...
end Parent.RarelyUsedOps;

     ...

end Parent;

Then you could used a similar set of instantiations:

with Parent;
package P is new Parent;

with P;
package R is new P.RarelyUsedOps;

Note that in both cases you instantiate a child/sub-package of the
newly instantiated package not of the original generic parent package.

--
Mark Biggar
mark.biggar@trustedsyslabsl.com



Sent via Deja.com
http://www.deja.com/



  parent reply	other threads:[~2001-01-29 17:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-29 16:30 (generic) child package of generic package; intantiation of Peter Hend�n
2001-01-29 17:20 ` Marc A. Criley
2001-01-29 17:24 ` mark.biggar [this message]
2001-01-29 17:25 ` Pat Rogers
2001-01-29 20:46   ` Peter Hend�n
2001-01-30 16:56     ` Tucker Taft
2001-01-30 21:33       ` Peter Hend�n
2001-01-30  4:48 ` Jeffrey Carter
2001-01-30 11:53   ` Peter Hend�n
  -- strict thread matches above, loose matches on Subject: below --
2001-01-31  5:34 Christoph Grein
replies disabled

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