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

138 lines
8.1 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: Issue EXIT-EXTENT-AND-CONDITION-SYSTEM Writeup</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="../Issues/iss149_w.htm">
<LINK REL=UP HREF="../Issues/iss151.htm">
<LINK REL=NEXT HREF="../Issues/iss152_w.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="../Issues/iss149_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss151.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss152_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue EXIT-EXTENT-AND-CONDITION-SYSTEM Writeup</H2>
<PRE><B>Issue:</B> <A HREF="iss151.htm">EXIT-EXTENT-AND-CONDITION-SYSTEM</A><P>
<B>References:</B> <A REL=DEFINITION HREF="../Body/s_catch.htm#catch"><B>CATCH</B></A>, <A REL=DEFINITION HREF="../Body/s_throw.htm#throw"><B>THROW</B></A>, <A REL=DEFINITION HREF="../Body/s_unwind.htm#unwind-protect"><B>UNWIND-PROTECT</B></A>,<P>
<A REL=DEFINITION HREF="../Body/m_handle.htm#handler-bind"><B>HANDLER-BIND</B></A>, <A REL=DEFINITION HREF="../Body/m_rst_bi.htm#restart-bind"><B>RESTART-BIND</B></A><P>
Related issues: <A HREF="iss152.htm">EXIT-EXTENT</A><P>
<B>Category:</B> CLARIFICATION<P>
<B>Edit history:</B> v1, 22 Feb 1991, Sandra Loosemore<P>
v2, 11 Mar 1991, Sandra Loosemore<P>
<P>
<B>Problem description:<P>
</B><P>
The <A HREF="iss152.htm">EXIT-EXTENT</A> issue doesn't specify how exit points interact with<P>
the dynamic bindings of condition handlers and restarts. At what<P>
point in the execution of non-local transfers of control do the<P>
extents of handlers and restarts established by <A REL=DEFINITION HREF="../Body/m_handle.htm#handler-bind"><B>HANDLER-BIND</B></A> and<P>
<A REL=DEFINITION HREF="../Body/m_rst_bi.htm#restart-bind"><B>RESTART-BIND</B></A> end?<P>
<P>
<B>Proposal (EXIT-EXTENT-AND-CONDITION-SYSTEM:LIKE-DYNAMIC-BINDINGS):<P>
</B><P>
Clarify that undoing of handler and restart bindings during an exit<P>
happens in parallel with the undoing of the bindings of special variables<P>
and <A REL=DEFINITION HREF="../Body/s_catch.htm#catch"><B>CATCH</B></A> tags, in the reverse order in which they were established.<P>
The effect of this is that the cleanup clauses of an <A REL=DEFINITION HREF="../Body/s_unwind.htm#unwind-protect"><B>UNWIND-PROTECT</B></A><P>
will see the same handler and restart bindings, as well as dynamic bindings<P>
and <A REL=DEFINITION HREF="../Body/s_catch.htm#catch"><B>CATCH</B></A> tags, as were visible with the <A REL=DEFINITION HREF="../Body/s_unwind.htm#unwind-protect"><B>UNWIND-PROTECT</B></A> was entered.<P>
<P>
<B>Examples:<P>
</B><P>
???<P>
<P>
<B>Rationale:<P>
</B><P>
Presumably many implementations use dynamic bindings and <A REL=DEFINITION HREF="../Body/s_catch.htm#catch"><B>CATCH</B></A> to <P>
implement handler and restart bindings.<P>
<P>
<B>Current Practice:<P>
</B><P>
The sample condition system implementation uses dynamic bindings and<P>
<A REL=DEFINITION HREF="../Body/s_catch.htm#catch"><B>CATCH</B></A> to implement handler and restart bindings.<P>
<P>
<B>Cost to Implementors:<P>
</B><P>
Probably none.<P>
<P>
<B>Cost to Users:<P>
</B><P>
Probably none.<P>
<P>
<B>Cost of non-adoption:<P>
</B><P>
Continuing vagueness in the language specification.<P>
<P>
<B>Performance impact:<P>
</B><P>
Probably none.<P>
<P>
<B>Benefits:<P>
</B><P>
The cost of non-adoption is avoided.<P>
<P>
<B>Esthetics:<P>
</B><P>
Being consistent with issue <A HREF="iss152.htm">EXIT-EXTENT</A> is a good thing. Whether<P>
issue <A HREF="iss152.htm">EXIT-EXTENT</A> was resolved in an esthetic manner is another <P>
question.<P>
<P>
<B>Discussion:<P>
</B><P>
This issue was raised by Barry Margolin on the X3J13 mailing list.<P>
<P>
Kim Barrett notes:<P>
<P>
A consequence of this proposal is that<P>
<P>
(<A REL=DEFINITION HREF="../Body/s_catch.htm#catch"><B>catch</B></A> 'foo<P>
(<A REL=DEFINITION HREF="../Body/m_hand_1.htm#handler-case"><B>handler-case</B></A><P>
(<A REL=DEFINITION HREF="../Body/s_unwind.htm#unwind-protect"><B>unwind-protect</B></A><P>
(<A REL=DEFINITION HREF="../Body/s_throw.htm#throw"><B>throw</B></A> 'foo <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>nil</B></A>)<P>
(<A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>error</B></A> &quot;foo&quot;))<P>
(<A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>error</B></A> () (<A REL=DEFINITION HREF="../Body/f_wr_pr.htm#print"><B>print</B></A> 'foo))))<P>
<P>
has undefined consequences. This is why I voted against <A HREF="iss152.htm">EXIT-EXTENT</A>. Of<P>
course, few people listened then so why should they listen now.<P>
<P>
Moon replies:<P>
<P>
....[this] is a consequence of <A HREF="iss152.htm">EXIT-EXTENT</A> and has<P>
nothing to do with <A HREF="iss151.htm">EXIT-EXTENT-AND-CONDITION-SYSTEM</A>, which speaks<P>
only of when bindings are disestablished, not when using those<P>
bindings becomes undefined, which is the subject of <A HREF="iss152.htm">EXIT-EXTENT</A>.<P>
<P>
<A HREF="iss151.htm">EXIT-EXTENT-AND-CONDITION-SYSTEM</A> tells us that the handler binding<P>
extablished by the <A REL=DEFINITION HREF="../Body/m_hand_1.htm#handler-case"><B>HANDLER-CASE</B></A> becomes disestablished when control<P>
passes outside the <A REL=DEFINITION HREF="../Body/m_hand_1.htm#handler-case"><B>HANDLER-CASE</B></A> and not before. In particular this<P>
binding is still established while the <A REL=DEFINITION HREF="../Body/s_unwind.htm#unwind-protect"><B>UNWIND-PROTECT</B></A> cleanup form<P>
is executing. It is difficult to imagine what other semantics<P>
for this part could be defensible.<P>
<P>
<A HREF="iss152.htm">EXIT-EXTENT</A> tells us that the exit point used by the handler established<P>
by the <A REL=DEFINITION HREF="../Body/m_hand_1.htm#handler-case"><B>HANDLER-CASE</B></A> cannot be used after the <A REL=DEFINITION HREF="../Body/s_throw.htm#throw"><B>THROW</B></A> commences. Note that<P>
this is not the same binding as the one discussed by <P>
<A HREF="iss151.htm">EXIT-EXTENT-AND-CONDITION-SYSTEM</A>. It is certainly possible to imagine<P>
other defensible semantics for this part, we spent years discussing it.<P>
<P>
JonL says:<P>
<P>
I can think of few things more horrible than re-opening the issue<P>
of <A HREF="iss152.htm">EXIT-EXTENT</A>.<P>
</PRE>
<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>