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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c39ad3e35a7690a9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.226.10 with SMTP id ro10mr720267pbc.6.1329306003660; Wed, 15 Feb 2012 03:40:03 -0800 (PST) Path: wr5ni27719pbc.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!aioe.org!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 15 Feb 2012 12:39:31 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Convention for naming of packages References: <4f355230$0$21451$ba4acef3@reader.news.orange.fr> <9q10nfFj2bU1@mid.individual.net> In-Reply-To: <9q10nfFj2bU1@mid.individual.net> Message-ID: <4f3b9973$0$7625$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 15 Feb 2012 12:39:32 CET NNTP-Posting-Host: cf9adc3e.newsspool1.arcor-online.net X-Trace: DXC=PE>D@Q0A_o>^8FBo0_81f>ic==]BZ:af>4Fo<]lROoR1<`=YMgDjhg2@:>SDEfdW76nc\616M64>:Lh>_cHTX3j=:C9id:iFfb3 X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2012-02-15T12:39:32+01:00 List-Id: On 15.02.12 07:13, Niklas Holsti wrote: > I tend to use the first letter of the array or type identifier: > > for E in Events_Type loop > for L in Event_Description(E).Lines'Range loop > Print (Event_Description(E).Lines(L))); > end loop; > end loop; In a nested loop, I found it helps (me) if at least one of the loop variables has a meaningful name (with "meaningful" to be defined in a moment). There is one exception. In cases like matrix computations, single letter variables are justified by readers' expectations, they are thus meaningful identifiers (which gives a definition of "meaningful"). This choice of identifiers happens to match Python (pylint) conventions, for row in data: if any (non_zero (c) for c in row): result.append (sum (row)) The corresponding Ada, if using arrays, will IMHO warrant the replacement of identifier "c" with a word, since the two occurrences of C will look oddly out of style in Ada. (Before Ada 2012, there was no syntactical notion of an iterator like that of current Python, so the loops look more involved.) It doesn't hurt (me) that Col is reminiscent of the full word "column"; the abbreviation seemed an established convention, and, therefore for Row in Data'Range loop for Col in Data(Row)'Range loop if Non_Zero (Data(Row)(Col)) then Result.Append (Sum (Data (Row))); exit; end if; end loop; end loop; When I wrote this using R in place of Row, and C in place of Col, something odd happened. R made me think of "resistance"! And this disturbing phenomenon, recursively, made me wonder about C ... The arguments in favor of words in Ada hinge on the validity of having readers' expectations guide the choice of identifiers. The set of readers includes, admittedly, oneself.