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.9 required=5.0 tests=BAYES_00 autolearn=ham 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!postnews.google.com!n59g2000hsh.googlegroups.com!not-for-mail From: "Adam Beneschan" Newsgroups: comp.lang.ada Subject: Re: Stupid question Date: 13 Apr 2007 08:35:53 -0700 Organization: http://groups.google.com Message-ID: <1176478553.026938.254630@n59g2000hsh.googlegroups.com> References: <1176414032.163717.31900@y80g2000hsf.googlegroups.com> <1176415338.362267.115580@l77g2000hsb.googlegroups.com> <1pyl2asiynhjs.117mopb54gcj7$.dlg@40tude.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1176478553 6834 127.0.0.1 (13 Apr 2007 15:35:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 13 Apr 2007 15:35:53 +0000 (UTC) In-Reply-To: <1pyl2asiynhjs.117mopb54gcj7$.dlg@40tude.net> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: n59g2000hsh.googlegroups.com; posting-host=66.126.103.122; posting-account=cw1zeQwAAABOY2vF_g6V_9cdsyY_wV9w Xref: g2news1.google.com comp.lang.ada:14981 Date: 2007-04-13T08:35:53-07:00 List-Id: On Apr 13, 1:20 am, "Dmitry A. Kazakov" wrote: > 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. Go back to 4.1.3. When you're specifying an expanded name, you can't use a prefix unless the prefix denotes a package, or an enclosing named construct. The prefix, here, "A", is not a package---it's a generic. And certainly you should know that you can't refer to things inside a generic (except from inside that generic). Suppose that, instead of making B a child unit, you had nested it inside A: generic package A is A1 : Integer; generic package B is end B; end A; Now, outside the declaration or body of A, you can't refer to "A.B" any more than you can refer to "A.A1". You need an instance to refer to either one, i.e. A_Inst.B or A_Inst.A1. Basically, you can't directly refer to identifiers defined inside a generic---that much should be well known. Well, generic child packages really are just about the same as nested generic packages. Personally, I find it helpful to think of child units (non-generic ones as well as generic ones) as being located inside their parents, even though they're textually not located inside anything. > 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). Yes, that's what I mean. Sorry. But it does solve your problem, doesn't it? Now you have no problem referring to A_Inst.A1, while the syntax you seem to prefer (with just one generic formal parameter) doesn't give you a way to do that. -- Adam