From: jsa@alexandria (Jon S Anthony)
Subject: Re: Generic children, instances and visibility...
Date: 1997/04/09
Date: 1997-04-09T00:00:00+00:00 [thread overview]
Message-ID: <JSA.97Apr9151107@alexandria> (raw)
In-Reply-To: 334BA5F2.4111@gsfc.nasa.gov
In article <334BA5F2.4111@gsfc.nasa.gov> Stephen Leake <Stephen.Leake@gsfc.nasa.gov> writes:
> with Parent.Child;
> with Inst_Types;
> package Parent.PC_Inst is new Parent.Child (Inst_Types.It);
>
> gnat says neither case allows visibility:
True. But that may or may not be accurate (though it probably is...)
> So, hoping that a private child would have visibility, I tried a third
> variation:
>
> with Parent.Child;
> with Inst_Types;
> private package Parent.Test is
> type It is new Parent.T with null record;
>
> package PC_Inst is new Parent.Child (Inst_Types.It);
Since PC_Inst is not a child of Parent, 12.3(11) seems to say that
this can't work. The case where the instance is a child of the parent
is the interesting one. What is more, this case "works" (according to
gnat) if you declare the IT type in a child package of Parent:
package Parent.Inst_Types is
type IT is new Parent.T with null record;
end Parent.Inst_Types;
with Parent.Child;
with Parent.Inst_Types;
package Parent.PC_Inst is new Parent.Child(Parent.Inst_Types.IT);
Hmmm, just checked and it also "works" if you just dump the
instantiation in Parent.Inst_Types:
with Parent.Child;
package Parent.Inst_Types is
type IT is new Parent.T with null record;
package PC_Inst is new Parent.Child(IT);
end Parent.Inst_Types;
Now this last case is really odd as it does not seem different (in the
relevant point - properties of IT visible at instantiation point) than
the case where Inst_Types is not a child and simply withs Parent to
derive the IT type. Now, I _am_ beginning to think that GNAT has a
bug here somewhere.
> It would seem that no generic can see inside type It; it is a limited
> private type, period.
That may well be true (actually the limited part is irrelevant), but
as the above shows, you can't use GNAT as a verification of this
statement. I was wondering about this from a "language lawyer" point
of view, but now am wondering if GNAT has a bug in it as well.
Tucker, Bob, Norman - any comments appreciated.
/Jon
--
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com
next prev parent reply other threads:[~1997-04-09 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-04-09 0:00 Generic children, instances and visibility Jon S Anthony
1997-04-09 0:00 ` Stephen Leake
1997-04-09 0:00 ` Jon S Anthony [this message]
1997-04-12 0:00 ` Tucker Taft
1997-04-13 0:00 ` Jon S Anthony
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox