From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1ef593126ef45087 X-Google-Attributes: gid103376,public From: jsa@alexandria (Jon S Anthony) Subject: Re: Generic children, instances and visibility... Date: 1997/04/09 Message-ID: #1/1 X-Deja-AN: 231868113 Distribution: world References: <334BA5F2.4111@gsfc.nasa.gov> Organization: PSI Public Usenet Link Newsgroups: comp.lang.ada Date: 1997-04-09T00:00:00+00:00 List-Id: In article <334BA5F2.4111@gsfc.nasa.gov> Stephen Leake 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