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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d89e2d213646aec8 X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news1.google.com!news.glorb.com!news2.telebyte.nl!news-fra1.dfn.de!news-ham1.dfn.de!news.uni-hamburg.de!cs.tu-berlin.de!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Mneson announcement and help request Date: Wed, 2 Jun 2004 11:41:33 +0000 (UTC) Organization: GMUGHDU Message-ID: References: NNTP-Posting-Host: l1-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1086176493 18487 134.91.1.34 (2 Jun 2004 11:41:33 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Wed, 2 Jun 2004 11:41:33 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/800)) Xref: controlnews3.google.com comp.lang.ada:1022 Date: 2004-06-02T11:41:33+00:00 List-Id: Georg Bauhaus wrote: : Marius Amado Alves wrote: : :> In general, I hate to see code that uses exceptions for normal control flow : :> processing. It certainly appears to : :> me that your code that makes use of the various For_Each_XXX type procedures : :> uses an exception : :> raise to terminate the search when "done". : : : : Yes, that is a controversial style. Some like it, some don't. Note the : : planned Ada standard containers are in this style. : : How about this, which doesn't need exceptions: [...] OK in my example you need to know where to stop before traversal. However, there is a third variation, only slightly different from the one Jeffrey Carter mentioned, and it still doesn't need exceptions with AI302. generic with procedure Process(Pointee: Sets_of_T.Cursor); with function Stop(Pointee: Sets_of_T.Cursor) return Boolean; -- terminate Process-ing when Stop says so procedure Traverse (container: Sets_of_T.Set); The loop is changed to while not Stop(current) loop -- the change process(current); next(current); -- moving the cursor was missing before :-( end loop; -- Georg