Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

No line available at 300 baud.


devel / comp.lang.ada / Re: Code flow control

SubjectAuthor
* Code flow controlKevin Chadwick
+* Re: Code flow controlJ-P. Rosen
|`* Re: Code flow controlDmitry A. Kazakov
| +- Re: Code flow controlKevin Chadwick
| `* Re: Code flow controlG.B.
|  +* Re: Code flow controlKevin Chadwick
|  |`- Re: Code flow controlRandy Brukardt
|  `* Re: Code flow controlDmitry A. Kazakov
|   `* Re: Code flow controlKevin Chadwick
|    `- Re: Code flow controlKevin Chadwick
+- Re: Code flow controlJeffrey R. Carter
`- Re: Code flow controlRoger Mc

1
Code flow control

<c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6182&group=comp.lang.ada#6182

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:ef4b:: with SMTP id t11mr11766084qvs.48.1634310523075;
Fri, 15 Oct 2021 08:08:43 -0700 (PDT)
X-Received: by 2002:a5b:846:: with SMTP id v6mr12435579ybq.457.1634310522888;
Fri, 15 Oct 2021 08:08:42 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 15 Oct 2021 08:08:42 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.203.39; posting-account=5K6RMgoAAADQeoHIOMi2dg5aYc0IVxGi
NNTP-Posting-Host: 92.40.203.39
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
Subject: Code flow control
From: kevc3...@gmail.com (Kevin Chadwick)
Injection-Date: Fri, 15 Oct 2021 15:08:43 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 23
 by: Kevin Chadwick - Fri, 15 Oct 2021 15:08 UTC

Although surprised that pragma No_Exception_Propagation seems to prevent access to some exception information. I am happy with Adas exception mechanism. I have read that exceptions should not be used for code flow.

For Ada after perusing various threads on this mailing list around best practice I am considering using exceptions locally but also have an in out variable for code flow control at the point of use. Is that the way with the caveat that it all depends on the task at hand?

In Go with vscode a static checker will warn if an error type variable is returned without a following if error utilisation (check usually of the form if err /= nil).

I have read that Spark has some kind of static analysis to achieve similar as it forbids exceptions.

It is not the end of the world but is there any static analyser that could do similar for Ada. IOW save me some time or perhaps worse whenever I have simply omitted the check by accident, in haste or distraction.

I'm sure I could quickly write a shell script easily enough for a specific design as in if keyword appears once but not again within x lines then shout at me but I am wondering if I am missing a tool or better practice before I do so?

Re: Code flow control

<skcesm$sgf$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6183&group=comp.lang.ada#6183

 copy link   Newsgroups: comp.lang.ada
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ros...@adalog.fr (J-P. Rosen)
Newsgroups: comp.lang.ada
Subject: Re: Code flow control
Date: Fri, 15 Oct 2021 19:48:06 +0200
Organization: Adalog
Lines: 38
Message-ID: <skcesm$sgf$1@dont-email.me>
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 15 Oct 2021 17:48:06 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2ea89f1e859d82315695367c89e9b825";
logging-data="29199"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/MzKqT0mdU9xtSQZ2hsCj"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:TLlGcsd7pefhKyOvbQ/hTkAqlq8=
In-Reply-To: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
Content-Language: fr
 by: J-P. Rosen - Fri, 15 Oct 2021 17:48 UTC

Le 15/10/2021 à 17:08, Kevin Chadwick a écrit :
> Although surprised that pragma No_Exception_Propagation seems to
> prevent access to some exception information. I am happy with Adas
> exception mechanism. I have read that exceptions should not be used
> for code flow.
Some people reserve exceptions for signalling errors. I regard them as a
way to handle "exceptional" situations, i.e. when the normal flow of
control cannot continue. For example, in a deep recursive search, they
are handy to stop the recursion and go back to top level when you have
found what you were looking for. Some would disagree with that.

> For Ada after perusing various threads on this mailing list around
> best practice I am considering using exceptions locally but also have
> an in out variable for code flow control at the point of use. Is that
> the way with the caveat that it all depends on the task at hand?
I definitely would prefer an exception, on the ground that you can omit
the check, but you cannot ignore an exception.

> In Go with vscode a static checker will warn if an error type
> variable is returned without a following if error utilisation (check
> usually of the form if err /= nil).
>
> I have read that Spark has some kind of static analysis to achieve
> similar as it forbids exceptions.
>
> It is not the end of the world but is there any static analyser that
> could do similar for Ada. IOW save me some time or perhaps worse
> whenever I have simply omitted the check by accident, in haste or
> distraction.
An interesting idea for AdaControl, especially if you have some funding
for it ;-)

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52
https://www.adalog.fr

Re: Code flow control

<skcf63$ujt$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6184&group=comp.lang.ada#6184

 copy link   Newsgroups: comp.lang.ada
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.not.acm.org (Jeffrey R. Carter)
Newsgroups: comp.lang.ada
Subject: Re: Code flow control
Date: Fri, 15 Oct 2021 19:53:06 +0200
Organization: Also freenews.netfront.net; news.tornevall.net;
news.eternal-september.org
Lines: 16
Message-ID: <skcf63$ujt$1@dont-email.me>
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 15 Oct 2021 17:53:07 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="d7c6f0aaa14e9d61cc9d2d9fdf35d1cb";
logging-data="31357"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198F7hVjmRLMsS3dTJqVGl4vAtYvxQH8Qk="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Cancel-Lock: sha1:r+cNkO/NjcOLcm8B1ZPU5WPzyy4=
In-Reply-To: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R. Carter - Fri, 15 Oct 2021 17:53 UTC

On 10/15/21 5:08 PM, Kevin Chadwick wrote:
>
> I'm sure I could quickly write a shell script easily enough for a specific design as in if keyword appears once but not again within x lines then shout at me but I am wondering if I am missing a tool or better practice before I do so?

What you're talking about is result codes. Exceptions exist because of problems
people encountered with result codes. Using result codes when you have
exceptions is like using conditional go-tos when you have if statements.

So, yes, there is better practice. It's called exceptions.

--
Jeff Carter
"I'll get broads up here like you wouldn't believe.
Swingers. Freaks. Nymphomaniacs. Dental hygienists."
Play It Again, Sam
125

Re: Code flow control

<skcfp6$j19$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6185&group=comp.lang.ada#6185

 copy link   Newsgroups: comp.lang.ada
Path: rocksolid2!i2pn.org!aioe.org!Hx95GBhnJb0Xc8StPhH8AA.user.46.165.242.91.POSTED!not-for-mail
From: mail...@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Code flow control
Date: Fri, 15 Oct 2021 20:03:16 +0200
Organization: Aioe.org NNTP Server
Message-ID: <skcfp6$j19$1@gioia.aioe.org>
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
<skcesm$sgf$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="19497"; posting-host="Hx95GBhnJb0Xc8StPhH8AA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.2.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Fri, 15 Oct 2021 18:03 UTC

On 2021-10-15 19:48, J-P. Rosen wrote:

> Some people reserve exceptions for signalling errors. I regard them as a
> way to handle "exceptional" situations, i.e. when the normal flow of
> control cannot continue. For example, in a deep recursive search, they
> are handy to stop the recursion and go back to top level when you have
> found what you were looking for. Some would disagree with that.

I strongly believe that this is the only consistent way to treat exceptions.

What I do wish is carefully designed exception contracts in Ada.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Code flow control

<4462bbfe-f4f3-4ca1-8684-36fde9b19fden@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6186&group=comp.lang.ada#6186

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:fad0:: with SMTP id p16mr13132506qvo.3.1634325587721;
Fri, 15 Oct 2021 12:19:47 -0700 (PDT)
X-Received: by 2002:a25:7e46:: with SMTP id z67mr14556037ybc.166.1634325587488;
Fri, 15 Oct 2021 12:19:47 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.usenet.farm!feed.usenet.farm!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 15 Oct 2021 12:19:47 -0700 (PDT)
In-Reply-To: <skcfp6$j19$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.203.48; posting-account=5K6RMgoAAADQeoHIOMi2dg5aYc0IVxGi
NNTP-Posting-Host: 92.40.203.48
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
<skcesm$sgf$1@dont-email.me> <skcfp6$j19$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4462bbfe-f4f3-4ca1-8684-36fde9b19fden@googlegroups.com>
Subject: Re: Code flow control
From: kevc3...@gmail.com (Kevin Chadwick)
Injection-Date: Fri, 15 Oct 2021 19:19:47 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Kevin Chadwick - Fri, 15 Oct 2021 19:19 UTC

On Friday, 15 October 2021 at 19:03:20 UTC+1, Dmitry A. Kazakov wrote:
> On 2021-10-15 19:48, J-P. Rosen wrote:
>
> > Some people reserve exceptions for signalling errors. I regard them as a
> > way to handle "exceptional" situations, i.e. when the normal flow of
> > control cannot continue. For example, in a deep recursive search, they
> > are handy to stop the recursion and go back to top level when you have
> > found what you were looking for. Some would disagree with that.
> I strongly believe that this is the only consistent way to treat exceptions.

If I am not mistaken.The ada 95 style guide states that you should not end a loop with an exception, on purpose.

Re: Code flow control

<skcmp7$mqd$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6187&group=comp.lang.ada#6187

 copy link   Newsgroups: comp.lang.ada
Path: rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bauh...@notmyhomepage.invalid (G.B.)
Newsgroups: comp.lang.ada
Subject: Re: Code flow control
Date: Fri, 15 Oct 2021 22:02:46 +0200
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <skcmp7$mqd$1@dont-email.me>
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
<skcesm$sgf$1@dont-email.me> <skcfp6$j19$1@gioia.aioe.org>
Reply-To: nonlegitur@notmyhomepage.de
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 15 Oct 2021 20:02:47 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4e896d80284ba48a3e3539e0eb17cf3a";
logging-data="23373"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18A8WEvQuePmhdfzudS7fohHookCL+H04A="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
Gecko/20100101 Thunderbird/78.14.0
Cancel-Lock: sha1:POmBtRxT6leOx/sWaiTvUFPL32g=
In-Reply-To: <skcfp6$j19$1@gioia.aioe.org>
Content-Language: en-US
 by: G.B. - Fri, 15 Oct 2021 20:02 UTC

On 15.10.21 20:03, Dmitry A. Kazakov wrote:
> On 2021-10-15 19:48, J-P. Rosen wrote:
>
>> Some people reserve exceptions for signalling errors. I regard them as a way to handle "exceptional" situations, i.e. when the normal flow of control cannot continue. For example, in a deep recursive search, they are handy to stop the recursion and go back to top level when you have found what you were looking for. Some would disagree with that.
>
> I strongly believe that this is the only consistent way to treat exceptions.

Once found, pass the result to the party that needs it.
Then, finish the computational task that found the result.
Is there anything besides exceptions to do that, and orderly?

Re: Code flow control

<23031592-5a56-4d56-bda7-34877588802dn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6188&group=comp.lang.ada#6188

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:5916:: with SMTP id 22mr15911108qty.158.1634333430715; Fri, 15 Oct 2021 14:30:30 -0700 (PDT)
X-Received: by 2002:a25:6106:: with SMTP id v6mr15327128ybb.531.1634333430400; Fri, 15 Oct 2021 14:30:30 -0700 (PDT)
Path: rocksolid2!i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 15 Oct 2021 14:30:30 -0700 (PDT)
In-Reply-To: <skcmp7$mqd$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23c0:f583:ec01:ad07:1c39:95d:9ca2; posting-account=5K6RMgoAAADQeoHIOMi2dg5aYc0IVxGi
NNTP-Posting-Host: 2a00:23c0:f583:ec01:ad07:1c39:95d:9ca2
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com> <skcesm$sgf$1@dont-email.me> <skcfp6$j19$1@gioia.aioe.org> <skcmp7$mqd$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <23031592-5a56-4d56-bda7-34877588802dn@googlegroups.com>
Subject: Re: Code flow control
From: kevc3...@gmail.com (Kevin Chadwick)
Injection-Date: Fri, 15 Oct 2021 21:30:30 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 16
 by: Kevin Chadwick - Fri, 15 Oct 2021 21:30 UTC

On Friday, 15 October 2021 at 21:02:49 UTC+1, G.B. wrote:
> On 15.10.21 20:03, Dmitry A. Kazakov wrote:
> > On 2021-10-15 19:48, J-P. Rosen wrote:
> >
> >> Some people reserve exceptions for signalling errors. I regard them as a way to handle "exceptional" situations, i.e. when the normal flow of control cannot continue. For example, in a deep recursive search, they are handy to stop the recursion and go back to top level when you have found what you were looking for. Some would disagree with that.
> >
> > I strongly believe that this is the only consistent way to treat exceptions.
> Once found, pass the result to the party that needs it.
> Then, finish the computational task that found the result.
> Is there anything besides exceptions to do that, and orderly?

I believe the ada 95 style guide recommended a standard goto?

Re: Code flow control

<skd0lu$ik$1@franka.jacob-sparre.dk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6191&group=comp.lang.ada#6191

 copy link   Newsgroups: comp.lang.ada
Path: rocksolid2!news.neodome.net!weretis.net!feeder8.news.weretis.net!newsfeed.xs3.de!callisto.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Code flow control
Date: Fri, 15 Oct 2021 17:51:41 -0500
Organization: JSA Research & Innovation
Lines: 36
Message-ID: <skd0lu$ik$1@franka.jacob-sparre.dk>
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com> <skcesm$sgf$1@dont-email.me> <skcfp6$j19$1@gioia.aioe.org> <skcmp7$mqd$1@dont-email.me> <23031592-5a56-4d56-bda7-34877588802dn@googlegroups.com>
Injection-Date: Fri, 15 Oct 2021 22:51:42 -0000 (UTC)
Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226";
logging-data="596"; mail-complaints-to="news@jacob-sparre.dk"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
 by: Randy Brukardt - Fri, 15 Oct 2021 22:51 UTC

"Kevin Chadwick" <kevc3no4@gmail.com> wrote in message
news:23031592-5a56-4d56-bda7-34877588802dn@googlegroups.com...
On Friday, 15 October 2021 at 21:02:49 UTC+1, G.B. wrote:
> On 15.10.21 20:03, Dmitry A. Kazakov wrote:
> > On 2021-10-15 19:48, J-P. Rosen wrote:

>> >> Some people reserve exceptions for signalling errors. I regard them as
>> >> a way to handle "exceptional" situations, i.e. when the normal flow of
>> >> control cannot continue. For example, in a deep recursive search, they
>> >> are handy to stop the recursion and go back to top level when you have
>> >> found what you were looking for. Some would disagree with that.
>> >
>> > I strongly believe that this is the only consistent way to treat
>> > exceptions.
>> Once found, pass the result to the party that needs it.
>> Then, finish the computational task that found the result.
>> Is there anything besides exceptions to do that, and orderly?

>I believe the ada 95 style guide recommended a standard goto?

Gotos only work within a single invocation of a single subprogram. It is
rarely the case that some complex computation only uses one subprogram, and
that's never the case in a recursive search (the example that J-P gave).

A program that tries to handle end-of-file by calling End_of_File all over
is (a) way more complex than necessary, and (b) likely to be wrong as some
case is missed. Handling End_Error makes way more sense.

Of course, if you *are* in a single subprogram, then the advice of the style
guide is good (exceptions having more overhead than gotos, especially when
they actually occur). They're best used when multiple subprograms (or
subprogram calls) are involved.

Randy.

Re: Code flow control

<68078608-c293-49e9-99a5-b03d7c99f740n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6192&group=comp.lang.ada#6192

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:238a:: with SMTP id fw10mr13879722qvb.30.1634340600907; Fri, 15 Oct 2021 16:30:00 -0700 (PDT)
X-Received: by 2002:a25:1dd7:: with SMTP id d206mr16130160ybd.486.1634340600744; Fri, 15 Oct 2021 16:30:00 -0700 (PDT)
Path: rocksolid2!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 15 Oct 2021 16:30:00 -0700 (PDT)
In-Reply-To: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=219.90.191.17; posting-account=d51RWwoAAADvR-x0zYAtT9z3CRxT1eXo
NNTP-Posting-Host: 219.90.191.17
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <68078608-c293-49e9-99a5-b03d7c99f740n@googlegroups.com>
Subject: Re: Code flow control
From: rogerm...@gmail.com (Roger Mc)
Injection-Date: Fri, 15 Oct 2021 23:30:00 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 8
 by: Roger Mc - Fri, 15 Oct 2021 23:30 UTC

On Saturday, October 16, 2021 at 2:08:44 AM UTC+11, kevc...@gmail.com wrote:
> I have read that exceptions should not be used for code flow.

I strongly agree that exceptions should not be used for code flow.
However, I do use them in some file handling situations.
I wondered about using assertions, but then thought probably not relevant.
Using them for code flow seems tantamount to using go-tos.

Roger

Re: Code flow control

<ske078$122h$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6193&group=comp.lang.ada#6193

 copy link   Newsgroups: comp.lang.ada
Path: rocksolid2!i2pn.org!aioe.org!Hx95GBhnJb0Xc8StPhH8AA.user.46.165.242.91.POSTED!not-for-mail
From: mail...@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Code flow control
Date: Sat, 16 Oct 2021 09:50:00 +0200
Organization: Aioe.org NNTP Server
Message-ID: <ske078$122h$1@gioia.aioe.org>
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
<skcesm$sgf$1@dont-email.me> <skcfp6$j19$1@gioia.aioe.org>
<skcmp7$mqd$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="34897"; posting-host="Hx95GBhnJb0Xc8StPhH8AA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.2.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Dmitry A. Kazakov - Sat, 16 Oct 2021 07:50 UTC

On 2021-10-15 22:02, G.B. wrote:
> On 15.10.21 20:03, Dmitry A. Kazakov wrote:
>> On 2021-10-15 19:48, J-P. Rosen wrote:
>>
>>> Some people reserve exceptions for signalling errors. I regard them
>>> as a way to handle "exceptional" situations, i.e. when the normal
>>> flow of control cannot continue. For example, in a deep recursive
>>> search, they are handy to stop the recursion and go back to top level
>>> when you have found what you were looking for. Some would disagree
>>> with that.
>>
>> I strongly believe that this is the only consistent way to treat
>> exceptions.
>
> Once found, pass the result to the party that needs it.
> Then, finish the computational task that found the result.
> Is there anything besides exceptions to do that, and orderly?

Exceptions is having two results: data read or file end, commit or
rollback, item parsed or syntax error, next item or completed etc.
Consequently there are two paths of execution, one per result. The more
frequent/regular/complex path runs as the normal flow another does as
exception propagation.

In a data flow architecture you can have as many paths as you wanted,
e.g. in a state machine. That does not work well as programming
paradigm. Two paths is just how much the programmer can handle.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Code flow control

<60346167-ea7c-40ee-bdf5-cc67b75fa964n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6195&group=comp.lang.ada#6195

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:627:: with SMTP id a7mr16453097qvx.13.1634390800618;
Sat, 16 Oct 2021 06:26:40 -0700 (PDT)
X-Received: by 2002:a25:ce14:: with SMTP id x20mr19943220ybe.139.1634390800467;
Sat, 16 Oct 2021 06:26:40 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 16 Oct 2021 06:26:40 -0700 (PDT)
In-Reply-To: <ske078$122h$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.203.51; posting-account=OCGnxwkAAADCyu751mus9xKbEvUSs9BP
NNTP-Posting-Host: 92.40.203.51
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
<skcesm$sgf$1@dont-email.me> <skcfp6$j19$1@gioia.aioe.org>
<skcmp7$mqd$1@dont-email.me> <ske078$122h$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <60346167-ea7c-40ee-bdf5-cc67b75fa964n@googlegroups.com>
Subject: Re: Code flow control
From: m8il1i...@gmail.com (Kevin Chadwick)
Injection-Date: Sat, 16 Oct 2021 13:26:40 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 43
 by: Kevin Chadwick - Sat, 16 Oct 2021 13:26 UTC

On Saturday, October 16, 2021 at 8:50:04 AM UTC+1, Dmitry A. Kazakov wrote:
> On 2021-10-15 22:02, G.B. wrote:
> > On 15.10.21 20:03, Dmitry A. Kazakov wrote:
> >> On 2021-10-15 19:48, J-P. Rosen wrote:
> >>
> >>> Some people reserve exceptions for signalling errors. I regard them
> >>> as a way to handle "exceptional" situations, i.e. when the normal
> >>> flow of control cannot continue. For example, in a deep recursive
> >>> search, they are handy to stop the recursion and go back to top level
> >>> when you have found what you were looking for. Some would disagree
> >>> with that.
> >>
> >> I strongly believe that this is the only consistent way to treat
> >> exceptions.
> >
> > Once found, pass the result to the party that needs it.
> > Then, finish the computational task that found the result.
> > Is there anything besides exceptions to do that, and orderly?
> Exceptions is having two results: data read or file end, commit or
> rollback, item parsed or syntax error, next item or completed etc.
> Consequently there are two paths of execution, one per result. The more
> frequent/regular/complex path runs as the normal flow another does as
> exception propagation.
>
> In a data flow architecture you can have as many paths as you wanted,
> e.g. in a state machine. That does not work well as programming
> paradigm. Two paths is just how much the programmer can handle.
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

My experience with exceptions and try catch even, is limited.

I am a little confused as to the optimum extent of their use between
this thread and the thread "best practice: error handling"

"https://groups.google.com/g/comp.lang.ada/c/xL0qGSUQSbE/m/N8LJ8VNMJEQJ"

I will look at some code on github to further my understanding.
If anyone has any links to good examples, then that would be useful?

Regards,
kc

Re: Code flow control

<876a7eba-9e2b-4503-b58f-230a560871c4n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6329&group=comp.lang.ada#6329

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:400c:: with SMTP id kd12mr25027103qvb.41.1637934244338;
Fri, 26 Nov 2021 05:44:04 -0800 (PST)
X-Received: by 2002:a25:e755:: with SMTP id e82mr15666089ybh.389.1637934244167;
Fri, 26 Nov 2021 05:44:04 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 26 Nov 2021 05:44:03 -0800 (PST)
In-Reply-To: <60346167-ea7c-40ee-bdf5-cc67b75fa964n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.193.119; posting-account=5K6RMgoAAADQeoHIOMi2dg5aYc0IVxGi
NNTP-Posting-Host: 92.40.193.119
References: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
<skcesm$sgf$1@dont-email.me> <skcfp6$j19$1@gioia.aioe.org>
<skcmp7$mqd$1@dont-email.me> <ske078$122h$1@gioia.aioe.org> <60346167-ea7c-40ee-bdf5-cc67b75fa964n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <876a7eba-9e2b-4503-b58f-230a560871c4n@googlegroups.com>
Subject: Re: Code flow control
From: kevc3...@gmail.com (Kevin Chadwick)
Injection-Date: Fri, 26 Nov 2021 13:44:04 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 8
 by: Kevin Chadwick - Fri, 26 Nov 2021 13:44 UTC

Whilst I like that exceptions with the GNAT compiler provide warnings
with pragma No_Exception_Propagation and that they cannot be
ignored at runtime.

Some of the comments agree but some seem to conflict with this video
about code flow. I agree with the video, actually. Especially wrt spaghetti
code potential and even more so, when declare blocks are in use.

"https://youtu.be/cv0l1LnhYmE"

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor