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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: G. B. Newsgroups: comp.lang.ada Subject: Re: stopping a loop iteration without exiting it Date: Sat, 6 Jan 2018 01:19:37 -0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <81971548-23c9-4927-a6a8-6f0f1dba896b@googlegroups.com> <867esx70lw.fsf@gaheris.avalon.lan> <86373k74qh.fsf@gaheris.avalon.lan> <87shbki0et.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 6 Jan 2018 01:19:37 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="22269e7badf940e8de1a9d98f5fbe6cf"; logging-data="3817"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/xLnETOZ+urjVRbN89+X4nYpblquTMwg8=" User-Agent: NewsTap/5.3.1 (iPhone/iPod Touch) Cancel-Lock: sha1:1+i/ReNZOgDBpF+IZfw7C65oIrQ= sha1:10RGWX8fzNFXPLLe51edS9QkqVY= Xref: reader02.eternal-september.org comp.lang.ada:49778 Date: 2018-01-06T01:19:37+00:00 List-Id: Paul Rubin wrote: > "; as > Mart van de Wege says, you could use GOTO for everything so none of it > is needed. The question is whether it improves code readability, > reliability, developer productivity, etc. Another question is what the alternative really is. Having both read and written Perl text, I still find it more promising to start a filter written like this: loop Process (Line, Result => Classification); case Classification is when Throwaway => null; when Hit => Handle (Factory.Make (Input => Line)); when Unclear => Report (Line); end case; Get_Line (Line); end loop; Subprogram Process then looks at a single line of input, in a way that is similar to the pattern parts of AWK programs. Actions are triggered by Handle only. Perl’s continue block has one noteworthy piece of design, I think. It allows expressing something that is going to happen each time around the loop irrespective of the loop’s other control structure. There doesn’t seem to be a way to express this fact clearly in most languages, including Ada. Conventions and idioms aren’t the same thing as a special structure provided by the language. while (Conditions) { ... } continue { ... } I am not convinced, though, that an uncontrollable iteration is a Good Thing.