From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Generic units and child units
Date: 1999/05/13
Date: 1999-05-13T00:00:00+00:00 [thread overview]
Message-ID: <wccemkl3wz9.fsf@world.std.com> (raw)
In-Reply-To: Pine.BSF.4.10.9905122013100.17334-100000@shell5.ba.best.com
Brian Rogoff <bpr@shell5.ba.best.com> writes:
> > generic
> > type Item is private;
> > package List is
> > ... blah blah
> > end List;
> >
> > generic
> > package List.Iterator is
> > ... blah blah
> > end List.Iterator;
>
> That's right, all children of a generic package must be generic.
> >
> >
> > In my test program I can instantiate a List for integers:
> >
> > with List;
> > procedure Test is
> > package Integer_List is new List (Item => Integer);
>
> package Integer_List_Iterator is new Integer_List.Iterator;
>
> is the correct syntax.
Right, but don't forget to say "with List.Iterator;". When you
instantiate List to create Integer_List, it's as if you were
instantiating the whole hierarchy of children, except that the children
of Integer_List are not visible unless the corresponding children of
List are with'ed. That is, "with List.Iterator;" causes
Integer_List.Iterator to be visible, so you can then instantiate it.
This is all sort of theoretical -- in practise, the compiler will
typically just instantiate the children it needs to; it typically
doesn't even know about the whole hierarchy, because new children can be
added later.
See RM-10.1.1 and 8.3(20).
- Bob
--
Change robert to bob to get my real email address. Sorry.
next prev parent reply other threads:[~1999-05-13 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-12 0:00 Generic units and child units Steve Folly
1999-05-12 0:00 ` Brian Rogoff
1999-05-13 0:00 ` Robert A Duff [this message]
1999-05-15 0:00 ` Matthew Heaney
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox