comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Whether to raise exception or End_of_List function
Date: 21 Nov 2001 12:53:06 -0500
Date: 2001-11-21T17:55:29+00:00	[thread overview]
Message-ID: <ud72cau4d.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: slrn9vnh96.55u.randhol+abuse@kiuk0156.chembio.ntnu.no

Preben Randhol <randhol+abuse@pvv.org> writes:

><snip>
> 
> 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



  parent reply	other threads:[~2001-11-21 17:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-21 15:17 Whether to raise exception or End_of_List function Preben Randhol
2001-11-21 16:32 ` Preben Randhol
2001-11-21 16:51 ` Mark Biggar
2001-11-21 17:00   ` Preben Randhol
2001-11-21 17:01 ` Larry Kilgallen
2001-11-21 17:03   ` Preben Randhol
2001-11-21 19:34   ` Ed Falis
2001-11-21 17:04 ` chris.danx
2001-11-21 17:09   ` chris.danx
2001-11-21 22:00   ` Larry Kilgallen
2001-11-21 17:11 ` Jeffrey Carter
2001-11-21 17:53 ` Stephen Leake [this message]
2001-11-21 18:51   ` Preben Randhol
2001-11-22  3:53     ` Nick Roberts
2001-11-22 10:23       ` Preben Randhol
2001-11-23 14:37       ` Preben Randhol
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox