From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=BAYES_40,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 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: eternal-september.org!reader02.eternal-september.org!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: Injection-Info: google-groups.googlegroups.com; posting-host=92.40.203.51; posting-account=OCGnxwkAAADCyu751mus9xKbEvUSs9BP NNTP-Posting-Host: 92.40.203.51 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <60346167-ea7c-40ee-bdf5-cc67b75fa964n@googlegroups.com> Subject: Re: Code flow control From: Kevin Chadwick Injection-Date: Sat, 16 Oct 2021 13:26:40 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:63021 List-Id: 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