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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.105.132 with SMTP id e126mr6863482itc.55.1515347275549; Sun, 07 Jan 2018 09:47:55 -0800 (PST) X-Received: by 10.157.64.70 with SMTP id o6mr432954oti.7.1515347274641; Sun, 07 Jan 2018 09:47:54 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!i6no1322083itb.0!news-out.google.com!b73ni4168ita.0!nntp.google.com!i6no1322081itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 7 Jan 2018 09:47:54 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=174.23.131.205; posting-account=tfeRYAoAAACibzLrD_Ytyp0eQjMq_Py9 NNTP-Posting-Host: 174.23.131.205 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: stopping a loop iteration without exiting it From: Micah Waddoups Injection-Date: Sun, 07 Jan 2018 17:47:55 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Body-CRC: 577375717 X-Received-Bytes: 3374 Xref: reader02.eternal-september.org comp.lang.ada:49804 Date: 2018-01-07T09:47:54-08:00 List-Id: On Wednesday, January 3, 2018 at 9:54:36 AM UTC-7, Mehdi Saada wrote: > Is there a way to tell to ignore the remaining of a loop ? Like an exit s= tatement, but instead of quiting the loop, it would go to the next iteratio= n. > Can we do this except with a recursive structure ? Of all the things I've read in this post, I think the closest thing to the = ideals and standards of Ada is the `goto My_Loop` idea. Making any named s= tructure flow control accessible with the goto statement, only specifying t= he next loop of such, and exiting any inner loops in the process reduces co= de written in some cases and more importantly, it is very clear where the d= ecision to exit/continue-next is made and exactly which loop is being jumpe= d to the next iteration. This short-circuit behavior is similar to the `an= d then` and `or else` convention used in Boolean condition testing. Unfortunately, this is not part of the Ada standard yet, and any changes/ad= ditions to the standard are not done lightly, since the real working world = relies on the long-term maintainability and robust nature of Ada. Therefor= e, it may never become part of the standard. I personally hope that the go= to convention is added, or if it is not, that some equiva= lent readability improvement is at least considered. Even so, the main pro= blem that probably prevented it from being added the first time it was sugg= ested is that it stops a `for` loop, which is for the sake of perfect reada= bility and predictability statically set to the range it is given. Exiting= is only very helpful and meaningful when a plain or named loop is used and= it would be the same with the goto convention. Since `goto` with labels i= s strongly discouraged, there is a subtle barrier of established practices = and lint-like tools to repurposing 'goto' when the over-all improvement is = mostly trivial. These are my thoughts, and as a bit of a purist, I do wish for the goto con= vention to be added, but I also respect the reasons it may never be.