From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Code flow control
Date: Fri, 15 Oct 2021 19:48:06 +0200 [thread overview]
Message-ID: <skcesm$sgf$1@dont-email.me> (raw)
In-Reply-To: <c2f132ab-dca4-4400-a913-12616c0d8489n@googlegroups.com>
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
next prev parent reply other threads:[~2021-10-15 17:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-15 15:08 Code flow control Kevin Chadwick
2021-10-15 17:48 ` J-P. Rosen [this message]
2021-10-15 18:03 ` Dmitry A. Kazakov
2021-10-15 19:19 ` Kevin Chadwick
2021-10-15 20:02 ` G.B.
2021-10-15 21:30 ` Kevin Chadwick
2021-10-15 22:51 ` Randy Brukardt
2021-10-16 7:50 ` Dmitry A. Kazakov
2021-10-16 13:26 ` Kevin Chadwick
2021-11-26 13:44 ` Kevin Chadwick
2021-10-15 17:53 ` Jeffrey R. Carter
2021-10-15 23:30 ` Roger Mc
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox