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: a07f3367d7,da85d9aaf769b16a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!x15g2000vbr.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Generic package parameters not externally visible : what's the rational ? Date: Mon, 26 Oct 2009 04:05:38 -0700 (PDT) Organization: http://groups.google.com Message-ID: <92abb636-b3a0-429b-b6b4-03b6abe2d206@x15g2000vbr.googlegroups.com> References: NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1256555138 545 127.0.0.1 (26 Oct 2009 11:05:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 26 Oct 2009 11:05:38 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x15g2000vbr.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8784 Date: 2009-10-26T04:05:38-07:00 List-Id: Yannick Duch=EAne wrote on comp.lang.ada: > Hello ghosts out there, > > 24h without even a single post on comp.lang.ada... I hope every body > is Ok. > > Still the time for my two cents of the day : parameters of generic > packages are not externally visible. I use to read in a few places on > the web, this is so to preserve type privacy, but without any examples > which could illustrate this view. > > What's the rational behind this ? > > I like to do something like this to work around this : > > generic > > =A0 =A0Parameter_Type is (<>); > > =A0 =A0-- Other generic parameters ... > > package Generic_Package is > > =A0 =A0-- Give external access to generic parameters which are not visibl= e > otherwise. > > =A0 =A0subtype Formal_Parameter_Type is Parameter_Type > > =A0 =A0-- The same for other generic parameters ... > > =A0 =A0-- Remaining of the package ... > > end Generic_Package; > > I feel it is oftenly useful to have external access to generic > parameters : it is more clear and more consistent than making > reference to stuffs from different source (finally, the package > instance is a place where all these references are available, so why > not use these). I feel this is especially useful when other generic > packages are instantiated using the same parameters used to > instantiate another generic packages. > > That's why I was wondering about the rational which is underlying to > this restriction (the one which disallows a generic parameter to be > externally visible). > > Have a nice time (if every one is Ok). (I'm OK, thank you, and qute busy with the Debian Policy for Ada and gnat-4.4....) I think this is at least consistent: the values of subprogram parameters are also invisible outside the subprogram. Making "in out" generic formal variables visible outside the generic would be dangerous IMHO. As for generic formal types, subprograms, packages and constants... why not. -- Ludovic Brenta.