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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,da85d9aaf769b16a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!m16g2000yqc.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Generic package parameters not externally visible : what's the rational ? Date: Tue, 27 Oct 2009 15:03:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3084820f-4799-4555-b309-92c8ff7e2436@m16g2000yqc.googlegroups.com> References: NNTP-Posting-Host: 86.66.190.2 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1256680996 32146 127.0.0.1 (27 Oct 2009 22:03:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 27 Oct 2009 22:03:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m16g2000yqc.googlegroups.com; posting-host=86.66.190.2; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8814 Date: 2009-10-27T15:03:10-07:00 List-Id: On 27 oct, 22:36, "Jeffrey R. Carter" wrote: > One possible rationale is: > > In order to reference the generic parameters from the instance, you have to have > visibility of the instantiation. If you have visibility of the instantiation, > then you have visibility of the generic actual parameters used in the > instantiation. Therefore, you do not need visibility of the generic parameters > from the instance, so why complicate the language by providing it? After that, I will then try to give a view of the other hand : One good reason to miss it, is when a package A has another package B in its formal parameters and this formal package parameter (B) is it self generic, and A needs to use some type which were given to instantiate the package B. This is an example case where the parameter which were used to instantiate a package, are not accessible from a point they are needed (if P instantiated B, of course P has access to parameters used to instantiate B, but this does not help A, it if ever itself also need these). More about this latter point : it may be possible, to just give to A, the same type, but if A has let say, two of three package in its formal parameters, then, the number of generic parameter may increase a bit too much, at the cost of readability or at the cost of easy of use. Using such redundancies sometime, in the opposite, help readability or is useful when it recall something explicitly, but sometime, when it is too much, it breaks readability and comes with a feeling of confusion. To come back to the first point : one other good reason apart of a generic package having another generic in its parameters, is when a generic package B may also be instantiated in a package A, which will then be use in another package C, which does not have direct access to the parameters used to instantiate the package (let say it was in a third package which A deeply rely on one, but not C). Then, one of the more natural way to access these, if ever needed for other stuff in C, is the generic package instance B itself. Randy Brukardt Wrote : > And changing it surely would be incompatible, at the very > least with use-visibility That's an interesting point indeed. I did not though about it at first sight, because I never Use.