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,fd8f3d2ebf73a4b7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-21 09:13:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!dispose.news.demon.net!demon!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: <68RK7.3295$AQ3.467408@news6-win.server.ntlworld.com> Subject: Re: Whether to raise exception or End_of_List function MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Wed, 21 Nov 2001 17:09:04 -0000 NNTP-Posting-Host: 213.104.128.9 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 1006362507 213.104.128.9 (Wed, 21 Nov 2001 17:08:27 GMT) NNTP-Posting-Date: Wed, 21 Nov 2001 17:08:27 GMT Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:16803 Date: 2001-11-21T17:09:04+00:00 List-Id: > > My question is which is the better solution; Exception or a End_of_List > > function and which would have fewer side effects? > > Have both! i.e. an End_Of_List function for when you need to know when > you've reached the end of a list, and an exception for when you fall of the > list and attempt to use it. > > I have a similar problem with a recent assignment, and I found both to be > helpful (exceptions are for getting the bugs out, and knowing where they are > (although not all bugs are detectable by exceptions)). An exception will be > generated anyway if your iterator attempts to use a null valued access type > (assuming that's how the implementation works), but you may want your own > exception -- it can be helpful sometimes. I wasn't clear there. Exceptions are for catching bugs and unexpected conditions, and *if possible* (and desirable) recover from them. If not then they are helpful when you need to fix a program. Thought it best to be clear on that, Chris > Chris >