67 lines
3.9 KiB
HTML
67 lines
3.9 KiB
HTML
![]() |
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
||
|
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
||
|
<HEAD>
|
||
|
<TITLE>29.3.17. Condition Handlers</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" Condition Handlers">
|
||
|
<meta name="keywords" value="clm">
|
||
|
<meta name="resource-type" value="document">
|
||
|
<meta name="distribution" value="global">
|
||
|
<P>
|
||
|
<b>Common Lisp the Language, 2nd Edition</b>
|
||
|
<BR> <HR><A NAME=tex2html5839 HREF="node333.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5837 HREF="node315.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5831 HREF="node331.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5841 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5842 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html5840 HREF="node333.html"> Printing Conditions</A>
|
||
|
<B>Up:</B> <A NAME=tex2html5838 HREF="node315.html"> Survey of Concepts</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html5832 HREF="node331.html"> Resignaling Conditions</A>
|
||
|
<HR> <P>
|
||
|
<H2><A NAME=SECTION0033317000000000000000>29.3.17. Condition Handlers</A></H2>
|
||
|
<P>
|
||
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
||
|
<A NAME=CONDITIONHANDLERS>A</A>
|
||
|
<i>handler</i> is a function of one argument, the condition to be handled. The
|
||
|
handler may inspect the object
|
||
|
to be sure it is ``interested'' in handling the condition.
|
||
|
<P>
|
||
|
A handler is executed in the dynamic context of the signaler, except that the
|
||
|
set of available condition handlers will have been rebound to the value that
|
||
|
was active at the time the condition handler was made active. The intent of
|
||
|
this is to prevent infinite recursion because of errors in a condition handler.
|
||
|
<P>
|
||
|
After inspecting the condition, the handler should take one of the following
|
||
|
actions:
|
||
|
<UL> <LI>
|
||
|
It might <i>decline</i> to handle the condition (by simply returning). When
|
||
|
this happens, the returned values are ignored and the effect is the same
|
||
|
as if the handler had been invisible to the mechanism seeking to find a
|
||
|
handler. The next handler in line will be tried, or if no such handler
|
||
|
exists, the condition will go unhandled.
|
||
|
<P>
|
||
|
<LI>
|
||
|
It might <i>handle</i> the condition (by performing some non-local transfer
|
||
|
of control). This may be done either primitively using <tt>go</tt>, <tt>return</tt>, or <tt>throw</tt>,
|
||
|
or more abstractly using a function such as <tt>abort</tt> or <tt>invoke-restart</tt>.
|
||
|
<P>
|
||
|
<LI>
|
||
|
It might signal another condition.
|
||
|
<P>
|
||
|
<LI>
|
||
|
It might invoke the interactive debugger.
|
||
|
</UL>
|
||
|
In fact, the latter two actions (signaling another condition or entering the
|
||
|
debugger) are really just ways of putting off the decision to either handle
|
||
|
or decline, or trying to get someone else to make such a decision. Ultimately,
|
||
|
all a handler can do is to handle or decline to handle.
|
||
|
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
|
||
|
<P>
|
||
|
<BR> <HR><A NAME=tex2html5839 HREF="node333.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5837 HREF="node315.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5831 HREF="node331.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5841 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5842 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html5840 HREF="node333.html"> Printing Conditions</A>
|
||
|
<B>Up:</B> <A NAME=tex2html5838 HREF="node315.html"> Survey of Concepts</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html5832 HREF="node331.html"> Resignaling Conditions</A>
|
||
|
<HR> <P>
|
||
|
<HR>
|
||
|
<P><ADDRESS>
|
||
|
AI.Repository@cs.cmu.edu
|
||
|
</ADDRESS>
|
||
|
</BODY>
|