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,d1c2be706bbed0a5 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!m37g2000prh.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Recursive parameters in generics Date: Wed, 25 Jul 2007 08:13:02 -0700 Organization: http://groups.google.com Message-ID: <1185376382.101594.14560@m37g2000prh.googlegroups.com> References: <1185292839.391337.258620@e16g2000pri.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1185376383 5069 127.0.0.1 (25 Jul 2007 15:13:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 25 Jul 2007 15:13:03 +0000 (UTC) In-Reply-To: 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: m37g2000prh.googlegroups.com; posting-host=66.126.103.122; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:1170 Date: 2007-07-25T08:13:02-07:00 List-Id: On Jul 24, 11:43 pm, "Grein, Christoph (Fa. ESG)" wrote: > Adam wrote a fair exegesis: > > > The second formal parameter is "with package This_A is new A (S => > > S)"; This matches My_A as long as the S parameter of This_A and My_A > > match... So the question now is whether My_A.S_Of and "whatever" > > statically denote the same constant, or are static expressions with > the > > same value (see 12.7(6)). > > ... > > To summarize my conclusions: (1) Your example *should* be legal, ... > > I'm not so sure since generic parameters are never static. The actual > could be an expression like > > S => Function_Call & Another_Non_Static; That's one of the reasons the phrase "when they're referred to outside the generic" showed up in my previous post. Inside the generic, I think the *intent* is that when the generic refers to S, the rules apply without reference to what the actual for S might be. But outside the instance (and, in some cases, inside the visible part of the instance), the rules apply as if S had been replaced by the actual, and the properties of the actual can be used. I think that's the very general principle involved; I'm not saying that the rules as written entirely implement this principle. But here's an example of what I mean: generic type T1 is private; package Pak1 is subtype T2 is T1; ... package New_Pak1 is new Pak1 (Integer); Inside Pak1, you can't refer to T2'Succ, since the generic isn't "allowed to know" that T2 will be an integer subtype; but outside the generic, New_Pak1.T2'Succ is certainly legal. Following the same general principle, my thought was that if A is instantiated (as My_A) with S=>"string literal", then while the code inside A would not be allowed to treat S as static, for code *outside* the generic, My_A.S (or in this case My_A.S_Of, which renames it) would be considered static since the actual parameter is a static expression. However, I'm not saying that the actual rules about generic objects and static stuff (4.9) support the general principle in this case. It may be that My_A.S_Of is not static and doesn't statically denote anything; and it may be that the rules are too ambiguous as currently written. I'm not sure, and I may need to study the RM a bit more closely. -- Adam