guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Do we have a standard for error checking/handling?


From: Rob Browning
Subject: Do we have a standard for error checking/handling?
Date: 05 May 2001 22:44:33 -0500
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

While porting SRFI-19, I started wondering about error handling
issues.  The reference implementation has fairly careful checks of all
arguments, etc. which is great from a debugging perspective, but not
so great from a performance perspective.  So after looking at other
scheme code in Guile, I took the middle ground of not checking the
argument types except in cases where not checking the type of the
argument could cause a nasty silent failure.

For example, passing a time of type time-utc to a function that's
expecting a time of type time-duration.  This would be a nasty silent
failure because since all time types have the exact same internal
structure, all of the operations would succeed, and the mistake might
propagate indefinitely far from the original source.

Another similar question is, how do we want to handle range checking.
For some of the operations, there is a very small legal range for some
fields (i.e. 1-31 for the day of the month).  Should this be checked
both when coming in as an argument, and/or after any relevant
modifications?

Finally, for SRFI-19, for example, how should errors be handled?  I
just modified Will's error routine to use throw, but I wondered if any
more specific tags should be used for time errrors (since Will does
note the "type" of the error), or should they all just be misc-errors.

Thanks

-- 
Rob Browning <address@hidden> PGP=E80E0D04F521A094 532B97F5D64E3930



reply via email to

[Prev in Thread] Current Thread [Next in Thread]