[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What happens when no handler is found?
- To: Brian Marick <marick@GSWD-VMS.ARPA>
- Subject: What happens when no handler is found?
- From: David A. Moon <Moon@SCRC-STONY-BROOK.ARPA>
- Date: Mon, 6 Jan 86 18:14 EST
- Cc: cl-error-handling@SU-AI.ARPA
- In-reply-to: <8601050031.AA00437@gswd-vms.ARPA>
Date: Sat, 4 Jan 86 18:31:03 CST
From: marick@gswd-vms (Brian Marick)
A comment on Kent Pitman's error-handling proposal: (Reposting)
Having SIGNAL return NIL if no handler is found makes me nervous; it seems
to assume that people will explicitly plan for the case where no handler is
found, whereas I expect many people will create bugs because they implicitly
assume that their condition will be handled. And even if detecting the case
of a missing handler by checking whether SIGNAL returns is OK, that doesn't
work with SIGNAL-CASE, which is expected to return and may return any value.
This is all based on the idea that there are two kinds of conditions:
errors and simple events. SIGNAL cannot return NIL when signalling an
error because the system guarantees that there is a default handler for
errors, which typically enters a debugger. Whether a condition is an error
or not is defined by inheritance from its parent.
I suppose SIGNAL-CASE of a simple event with no handler simply returns NIL
without executing any of the clauses, but the proposal doesn't say anything
There's a distinction between code that's sending a signal to ask for help
and code that's sending a signal because there's nothing left for it to do,
no matter what. How that distinction meshes with the definitions of SIGNAL,
SIGNAL-CASE, ERROR, and ERROR-CASE is not clear enough.
I consider it a good idea to use the ERROR function when there's nothing left to
do, thus making it clear that you don't expect a return.
SIGNAL-CASE -- by default, it is an error (as above) for no handler to be
found. If one of the clauses of the SIGNAL-CASE is headed by :NO-HANDLER (or
a list containing :NO-HANDLER), that the body of that clause is invoked.
This would be a reasonable alternative to what I supposed in my second paragraph.