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 14:00:06 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.mathworks.com!nycmny1-snh1.gtei.net!chcgil2-snf1.gtei.net!news.gtei.net!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: Whether to raise exception or End_of_List function Date: 21 Nov 2001 16:00:00 -0600 Organization: LJK Software Message-ID: <1tgHsPfj0IUP@eisner.encompasserve.org> References: <68RK7.3295$AQ3.467408@news6-win.server.ntlworld.com> NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1006380002 17478 192.135.80.34 (21 Nov 2001 22:00:02 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Wed, 21 Nov 2001 22:00:02 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:16819 Date: 2001-11-21T16:00:00-06:00 List-Id: In article <68RK7.3295$AQ3.467408@news6-win.server.ntlworld.com>, "chris.danx" writes: >> 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. "Have both" is exactly equivalent to "have a function", since if there is a function and the caller ignores it _some_ action must be taken. Raising an exception in such circumstances is much more in the Ada tradition than returning a random entry from the middle of the list :-)