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-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!news.cse.ohio-state.edu!usenet01.sei.cmu.edu!elk.ncren.net!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Generic package parameters not externally visible : what's the rational ? Date: Mon, 26 Oct 2009 11:02:48 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <92abb636-b3a0-429b-b6b4-03b6abe2d206@x15g2000vbr.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1256569369 19249 192.74.137.71 (26 Oct 2009 15:02:49 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 26 Oct 2009 15:02:49 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:y+cNqmTIYaUoYm7Ogs13mIlM6r4= Xref: g2news2.google.com comp.lang.ada:8786 Date: 2009-10-26T11:02:48-04:00 List-Id: Ludovic Brenta writes: > 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. I don't buy the analogy with subprograms. When you "instantiate" (i.e. call) a subprogram, you don't create a nameable entity that can be referred to from outside. A better analogy would be discriminants, which are really parameters passed in to a type when you "instantiate" it (i.e. create an object of the type). And the discriminants are visible from outside the object, as they should be. I don't see any particular danger for the "in out" case. It would mean you can reach in and change it from the outside, but that's true of regular variables declared in the generic package spec. So don't do that. (It's also true for "in out"s in the formal package case, if I remember correctly -- I'm too lazy to look it up right now.) Anyway, generic formal "in out" parameters are used approximately never, so I don't care that much if they're slightly dangerous. - Bob