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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2948948ddf794344 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Stupid question Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1176414032.163717.31900@y80g2000hsf.googlegroups.com> <1176415338.362267.115580@l77g2000hsb.googlegroups.com> Date: Fri, 13 Apr 2007 10:20:34 +0200 Message-ID: <1pyl2asiynhjs.117mopb54gcj7$.dlg@40tude.net> NNTP-Posting-Date: 13 Apr 2007 10:20:34 CEST NNTP-Posting-Host: d60568f8.newsspool3.arcor-online.net X-Trace: DXC=djGfdT5;lkRAX0F2i>\BH3YR\@63>n8SU:TDNcfSJ;bb[UFCTGGVUmh?TLK[5LiR>kgRIXjVKmBOOlW X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:14976 Date: 2007-04-13T10:20:34+02:00 List-Id: On 12 Apr 2007 15:02:18 -0700, Adam Beneschan wrote: > I wrote: > >> On Apr 12, 1:05 pm, "Dmitry A. Kazakov" >> wrote: >> >>> generic >>> package A is >>> A1 : Integer; >>> end A; >> >>> generic >>> package A.B is >>> end A.B; >> >>> with A.B; >>> generic >>> with package A_B is new A.B (<>); >>> package C is >>> -- What is the name of A1 from A of A_B? >>> end C; >> >> I am betting that if you try to compile just the code snippet you've >> got, you will figure out your answer. > > Sorry about that answer. I made the rash assumption that you would be > using a compiler that works. But apparently that's not necessarily > the case. > > The version of GNAT I've got installed compiles the above code with no > errors, despite the fact that it's illegal. I was assuming that you'd > get an error and the error would help you figure out what was wrong; > but I didn't figure on this happening. [OK, GNAT has *lots* of problems with generics, it always had. I wonder when AdaCore would finally decide to rewrite generics from scrap. But that's aside.] Are you saying that it is illegal to refer to generic children of generic packages as generic packages? I don't see where 12.7 states it. 12.7(4): "The generic_package_name shall denote a generic package (the template for the formal package); the formal package is an instance of the template." A.B is definitely a generic package to me. > The problem is that you cannot refer to A.B the way you did in your > "with package" declaration; you can only refer to A_Inst.B where > A_Inst is an instance of A (A_Inst could be another generic formal > package). Well, you mean that dreadful: with A.B; generic with package A_Inst is new A (<>); with package A_B_Inst is new A_Inst.B (<>); package C is end C; This what I am trying to avoid. It is awful (and GNAT has problems with the constructs like that). -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de