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,55f6e230b02eff2f X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.194.251.MISMATCH!transit4.readnews.com!news-out.readnews.com!news-xxxfer.readnews.com!panix!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Containers - nontrivial element access Date: Wed, 03 Oct 2007 20:22:22 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1191275759.184463.238350@n39g2000hsh.googlegroups.com> <1191343071.685478.146710@19g2000hsx.googlegroups.com> <1191358939.031798.177670@k79g2000hse.googlegroups.com> <1191363628.908691.313970@k79g2000hse.googlegroups.com> <1191441598.702440.314410@22g2000hsm.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1191457342 14869 192.74.137.71 (4 Oct 2007 00:22:22 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 4 Oct 2007 00:22:22 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:GYHUwrLmlUXt0hzvj7EwOqLOSf0= Xref: g2news2.google.com comp.lang.ada:2287 Date: 2007-10-03T20:22:22-04:00 List-Id: Maciej Sobczak writes: > On 3 Pa , 00:20, Matthew Heaney wrote: > >> > BTW - above, PX plays the role of that additional variable that is >> > sneaked around to the second procedure. Here it just pretends to not >> > exist by taking the form of a parameter in the outer procedure. I >> > don't think there is a reasonable way to avoid it. >> >> The number of "additional variables" is exactly the same in both the C+ >> + and Ada examples. The only difference is how the variables are >> named. > > No. The difference is in whether the subprogram's protocol is fully > described by its signature. > > Your nested procedures have the signature that gives provisions for > one parameter only. The other one is sneaked in bypassing the > signature (so that the protocol is wider than the signature and this > is not explicit). This hinders analysis. I don't agree. In Ada, and many other languages, you have to get used to nested subprograms, and the fact that they can see more-global stuff. It's really not a big deal, so long as you keep them small. > I can even think about coding standards that explicitly forbid > subprograms that use anything other than what is in their signature > (except for the main subprogram, which might need to access some > library-level objects). I can imagine that, too. In fact I've seen it. But it's not really a good idea. You can't reasonably do iterators, for example, without some sort of nested procedures. > Your solution requires some dose of liberal thinking, which I'm not > easily willing to accept in the language that boasts high-integrity > mindset. ;-) - Bob