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,81bb2ce65a3240c3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.125.233 with SMTP id mt9mr5434459pbb.5.1335430044332; Thu, 26 Apr 2012 01:47:24 -0700 (PDT) Path: r9ni100011pbh.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!noris.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 26 Apr 2012 10:46:43 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: What would you like in Ada202X? 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> <86r4vb0whn.fsf@gaheris.avalon.lan> In-Reply-To: <86r4vb0whn.fsf@gaheris.avalon.lan> Message-ID: <4f990b73$0$16283$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 26 Apr 2012 10:46:43 CEST NNTP-Posting-Host: 5940fb4c.newsspool1.arcor-online.net X-Trace: DXC==LhbO2O00fmf1oJaJ0@dmgic==]BZ:afn4Fo<]lROoRa4nDHegD_]Re?kP8HCcJ\IcA:ho7QcPOVci\HQGK[RfkejA^ig`cJkTf X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-04-26T10:46:43+02:00 List-Id: On 26.04.12 09:43, Mart van de Wege wrote: > The canonical example is processing a file with comment lines starting > with '#': > > while (<$file>) { > next if /^#/; # skip comment lines > [...Do stuff with line ...] > } Inherited from Unix scripting, for files that don't have section indicators, and predating to the more shiny features of later versions of Perl. When this scheme is used with more prefixes besides /^#/, I'd immediately want a filtering capability, perhaps some abstraction, and this filter will likely use Perl 5.10.x's new switch/when capabilities, or one of its simpler predecessors. There are really many modes of expressing Perl things now, at all levels of language, including 3 (three!) different gotos besides next and last! And "until", and "for", and "foreach", and "each", and "redo" and other micro-optimizations that are as productive as product diversification can make them: no new effects, but many ways to do the same thing, all useful in avoiding data types describing the intentions, and all of them understandable as long as you write code in just one version of Perl. Perhaps someone could introduce an O(f(TIMTOWTDI)) notation for complexity at the syntax level. Perl certainly isn't linear in this regard, while Ada was required to be. :-) > 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. Actually, "next" in Perl doesn't jump to the top of the loop. It jumps to its bottom, because Perl has "continue" in its syntax: $x = ...; while ($condition->($x)) { next if ...; ... } continue { $x += ...; } > 'next' statements littered throughout the body of the > loop are frowned upon. Yet, multiple uses of "last"(?) were recommended to emulate a switch statement prior to Perl 5.something...