1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Body/09_ad.htm
2024-04-01 10:24:07 +02:00

48 lines
6.8 KiB
HTML

<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
<HTML>
<HEAD>
<TITLE>CLHS: Section 9.1.4</TITLE>
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
<LINK REL=TOP HREF="../Front/index.htm">
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
<LINK REL=PREV HREF="09_acae.htm">
<LINK REL=UP HREF="09_a.htm">
<LINK REL=NEXT HREF="09_ada.htm">
</HEAD>
<BODY>
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="09_acae.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="09_a.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="09_ada.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>
9.1.4 Signaling and Handling Conditions</H2> <P>
The operation of the condition system depends on the ordering of active <A REL=DEFINITION HREF="26_glo_a.htm#applicable_handler"><I>applicable handlers</I></A> from most recent to least recent. <P>
Each <A REL=DEFINITION HREF="26_glo_h.htm#handler"><I>handler</I></A> is associated with a <A REL=DEFINITION HREF="26_glo_t.htm#type_specifier"><I>type specifier</I></A> that must designate a <A REL=DEFINITION HREF="26_glo_s.htm#subtype"><I>subtype</I></A> of <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="e_cnd.htm#condition"><B>condition</B></A>. A <A REL=DEFINITION HREF="26_glo_h.htm#handler"><I>handler</I></A> is said to be <A REL=DEFINITION HREF="26_glo_a.htm#applicable"><I>applicable</I></A> to a <A REL=DEFINITION HREF="26_glo_c.htm#condition"><I>condition</I></A> if that <A REL=DEFINITION HREF="26_glo_c.htm#condition"><I>condition</I></A> is of the <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> designated by the associated <A REL=DEFINITION HREF="26_glo_t.htm#type_specifier"><I>type specifier</I></A>. <P>
<A REL=DEFINITION HREF="26_glo_a.htm#active"><I>Active</I></A> <A REL=DEFINITION HREF="26_glo_h.htm#handler"><I>handlers</I></A> are <I>established</I> by using <A REL=DEFINITION HREF="m_handle.htm#handler-bind"><B>handler-bind</B></A> (or an abstraction based on <A REL=DEFINITION HREF="m_handle.htm#handler-bind"><B>handler-bind</B></A>, such as <A REL=DEFINITION HREF="m_hand_1.htm#handler-case"><B>handler-case</B></A> or <A REL=DEFINITION HREF="m_ignore.htm#ignore-errors"><B>ignore-errors</B></A>). <P>
<A REL=DEFINITION HREF="26_glo_a.htm#active"><I>Active</I></A> <A REL=DEFINITION HREF="26_glo_h.htm#handler"><I>handlers</I></A> can be <I>established</I> within the dynamic scope of other <A REL=DEFINITION HREF="26_glo_a.htm#active"><I>active</I></A> <A REL=DEFINITION HREF="26_glo_h.htm#handler"><I>handlers</I></A>. At any point during program execution, there is a set of <A REL=DEFINITION HREF="26_glo_a.htm#active"><I>active</I></A> <A REL=DEFINITION HREF="26_glo_h.htm#handler"><I>handlers</I></A>. When a <A REL=DEFINITION HREF="26_glo_c.htm#condition"><I>condition</I></A> is signaled, the <A REL=DEFINITION HREF="26_glo_m.htm#most_recent"><I>most recent</I></A> active <A REL=DEFINITION HREF="26_glo_a.htm#applicable_handler"><I>applicable handler</I></A> for that <A REL=DEFINITION HREF="26_glo_c.htm#condition"><I>condition</I></A> is selected from this set. Given a <A REL=DEFINITION HREF="26_glo_c.htm#condition"><I>condition</I></A>, the order of recentness of active <A REL=DEFINITION HREF="26_glo_a.htm#applicable_handler"><I>applicable handlers</I></A> is defined by the following two rules: <P>
<P><DL><P>
<DT>1. Each handler in a set of active handlers H1 is more recent than every handler in a set H2 if the handlers in H2 were active when the handlers in H1 were established. <P><DD>
<DT>2. Let h1 and h2 be two applicable active handlers established by the same <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A>. Then h1 is more recent than h2 if h1 was defined to the left of h2 in the <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> that established them. <P><DD>
<P></DL><P>
Once a handler in a handler binding <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> (such as <A REL=DEFINITION HREF="m_handle.htm#handler-bind"><B>handler-bind</B></A> or <A REL=DEFINITION HREF="m_hand_1.htm#handler-case"><B>handler-case</B></A>) has been selected, all handlers in that <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> become inactive for the remainder of the signaling process. While the selected <A REL=DEFINITION HREF="26_glo_h.htm#handler"><I>handler</I></A> runs, no other <A REL=DEFINITION HREF="26_glo_h.htm#handler"><I>handler</I></A> established by that <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> is active. That is, if the <A REL=DEFINITION HREF="26_glo_h.htm#handler"><I>handler</I></A> declines, no other handler established by that <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> will be considered for possible invocation. <P>
The next figure shows <A REL=DEFINITION HREF="26_glo_o.htm#operator"><I>operators</I></A> relating to the <I>handling</I> of <A REL=DEFINITION HREF="26_glo_c.htm#condition"><I>conditions</I></A>. <P>
<PRE>
<A REL=DEFINITION HREF="m_handle.htm#handler-bind">handler-bind</A> <A REL=DEFINITION HREF="m_hand_1.htm#handler-case">handler-case</A> <A REL=DEFINITION HREF="m_ignore.htm#ignore-errors">ignore-errors</A>
</PRE>
<P><B>Figure 9-4. Operators relating to handling conditions.</B> <P>
<A REL=CHILD HREF="09_ada.htm"><H2>
9.1.4.1 Signaling</H2></A><P>
<A REL=CHILD HREF="09_adb.htm"><H2>
9.1.4.2 Restarts</H2></A><P><HR>
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
</BODY>
</HTML>