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: 103376,81bb2ce65a3240c3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.213.106 with SMTP id nr10mr5297478pbc.2.1335426316474; Thu, 26 Apr 2012 00:45:16 -0700 (PDT) Path: r9ni99854pbh.0!nntp.google.com!news1.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Mart van de Wege Newsgroups: comp.lang.ada Subject: Re: What would you like in Ada202X? Date: Thu, 26 Apr 2012 09:43:00 +0200 Message-ID: <86r4vb0whn.fsf@gaheris.avalon.lan> References: <3637793.35.1335340026327.JavaMail.geo-discussion-forums@ynfi5> <31103380.3735.1335377235157.JavaMail.geo-discussion-forums@vbuo17> <26317529.742.1335381313996.JavaMail.geo-discussion-forums@ynje10> <17572718.3572.1335384748259.JavaMail.geo-discussion-forums@vbbfk16> <30695328.1199.1335386401806.JavaMail.geo-discussion-forums@yndm3> Mime-Version: 1.0 X-Trace: individual.net gHQWb9bODYw3470SEb6owQs7ZG6fsfxCbjisR89Uz25iFWTgi+ X-Orig-Path: gaheris.avalon.lan!not-for-mail Cancel-Lock: sha1:cK2B3iMHjMfLzzPOEALsw2swK7c= sha1:mtfkT2EVbebWcIs+3u7NPrqqCv0= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Content-Type: text/plain; charset=us-ascii Date: 2012-04-26T09:43:00+02:00 List-Id: Adam Beneschan writes: > On Wednesday, April 25, 2012 1:12:28 PM UTC-7, > okel...@users.sourceforge.net wrote: >> On Wednesday, April 25, 2012 9:15:13 PM UTC+2, Adam Beneschan wrote: >> > And why would having a "continue" statement be better than the >> > workaround? >> Conciseness, plus avoidance of gratuitous "goto" (banned by various >> coding guidelines) > > This is the sort of thing that makes me want to cry. There's a reason > "goto" is banned from some coding guidelines, and it's not because one > day Dijkstra came down from a mountain with a slab that said "Thou > shalt not use goto". It's banned because in most cases, using it > negatively impacts readability and (as Jeff said) there's almost > always a better way. I've tried to argue here that using "continue" > is worse for readability than using a "goto" in this case--so if I'm > right, it would make no sense to have coding guidelines that disallow > "goto" and allow "continue". Of course, if you're able to argue that > the "continue" is more readable in this case, please do so. But I > suspect that's not possible if ... > Hmm. I like the Perl use of 'next' and 'last' to influence looping. Especially when looping over a list of values, it is nice to test for values you don't want to process at the start of the loop, and immediately go to the next iteration. The canonical example is processing a file with comment lines starting with '#': while (<$file>) { next if /^#/; # skip comment lines [...Do stuff with line ...] } Now, this is a lot clearer, and IMO a lot more elegant, than putting a label on the end of the loop and use 'goto label'. Although it *is* considered good practice to put your 'next' statements at the top of the loop to make clear on what conditions the main body will be skipped. 'next' statements littered throughout the body of the loop are frowned upon. Mart -- "We will need a longer wall when the revolution comes." --- AJS, quoting an uncertain source.