64 lines
4 KiB
HTML
64 lines
4 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.5. Restarts</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value=" Restarts">
|
|
<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=tex2html5695 HREF="node321.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5693 HREF="node315.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5687 HREF="node319.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5697 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5698 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html5696 HREF="node321.html"> Anonymous Restarts</A>
|
|
<B>Up:</B> <A NAME=tex2html5694 HREF="node315.html"> Survey of Concepts</A>
|
|
<B> Previous:</B> <A NAME=tex2html5688 HREF="node319.html"> Object-Oriented Basis of </A>
|
|
<HR> <P>
|
|
<H2><A NAME=SECTION003335000000000000000>29.3.5. Restarts</A></H2>
|
|
<P>
|
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
|
<A NAME=RESTARTS>In</A>
|
|
older Lisp dialects (such as MacLisp), an attempt to signal an error of a
|
|
given type often carried with it an implicit promise to support the standard
|
|
recovery strategy for that type of error. If the signaler knew the type of
|
|
error but for whatever reason was unable to deal with the standard recovery
|
|
strategy for that kind of error, it was necessary to signal an untyped error
|
|
(for which there was no defined recovery strategy). This sometimes led to
|
|
confusion when people signaled typed errors without realizing the full
|
|
implications of having done so, but more often than not it meant that users
|
|
simply avoided typed errors altogether.
|
|
<P>
|
|
The Common Lisp Condition System, which is modeled after the Zetalisp condition system,
|
|
corrects this troublesome aspect of previous Lisp dialects by creating a clear
|
|
separation between the act of signaling an error of a particular type and the
|
|
act of saying that a particular way of recovery is appropriate. In the <tt>divide</tt>
|
|
example above, simply signaling an error does not imply a willingness on the
|
|
part of the signaler to cooperate in any corrective action. For example, the
|
|
following sample interaction illustrates that the only recovery action
|
|
offered for this error is ``Return to Lisp Toplevel'':
|
|
<P><pre>
|
|
Lisp> (+ (divide 3 0) 7)
|
|
Error: Attempt to divide 3 by 0.
|
|
To continue, type :CONTINUE followed by an option number:
|
|
1: Return to Lisp Toplevel.
|
|
Debug> :continue 1
|
|
Returned to Lisp Toplevel.
|
|
Lisp>
|
|
</pre><P>
|
|
When an error is detected and the function <tt>error</tt> is called, execution cannot
|
|
continue normally because <tt>error</tt> will not directly return. Control can be
|
|
transferred to other points in the program, however, by means of specially
|
|
established ``restarts.''
|
|
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html5695 HREF="node321.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5693 HREF="node315.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5687 HREF="node319.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5697 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5698 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html5696 HREF="node321.html"> Anonymous Restarts</A>
|
|
<B>Up:</B> <A NAME=tex2html5694 HREF="node315.html"> Survey of Concepts</A>
|
|
<B> Previous:</B> <A NAME=tex2html5688 HREF="node319.html"> Object-Oriented Basis of </A>
|
|
<HR> <P>
|
|
<HR>
|
|
<P><ADDRESS>
|
|
AI.Repository@cs.cmu.edu
|
|
</ADDRESS>
|
|
</BODY>
|