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:58:24 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Whether to raise exception or End_of_List function Date: 21 Nov 2001 12:53:06 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1006365329 29626 128.183.220.71 (21 Nov 2001 17:55:29 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 21 Nov 2001 17:55:29 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:16809 Date: 2001-11-21T17:55:29+00:00 List-Id: Preben Randhol writes: > > > My question is which is the better solution; Exception or a End_of_List > function and which would have fewer side effects? You should always provide a function that allows a user to determine whether an exception would be raised, for _all_ operations in your library. Some people like to just let the exception be raised, others prefer to check for it. Some coding guidelines _forbid_ the raising of exceptions, so checking routines are required. A library should support both styles of coding, so it should provide both meaningful exceptions (not just Constraint_Error), and checking functions. Side effects can be an issue with some subprograms. If a subprogram has 'out' parameters, it is implementation-dependent whether they are set when an exception is raised. That's an additional reason to provide a checking routine, but it's not usually very important. -- -- Stephe