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

What happens when no handler is found?

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.

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.

How if their definitions are modified/clarified to say

SIGNAL -- control never resumes in the signalling function.  It is an error
(with type NO-SUCH-HANDLER or whatever) for no handler to be found.

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.

ERROR -- control never resumes in the signalling function.  If no handler is
found, the signalled condition is passed to the debugger.  (The distinction
between this and SIGNAL is that the error reported to the user is what was
discovered by the program, not by the error system.)

ERROR-CASE -- just like now.  A :NO-HANDLER clause makes no sense here.

Brian Marick