| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>Restarts (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="Restarts (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="Restarts (ANSI and GNU Common Lisp Document)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| 13 |
<link href="index.html" rel="start" title="Top"> |
| 14 |
<link href="Signaling-and-Handling-Conditions.html" rel="up" title="Signaling and Handling Conditions"> |
| 15 |
<link href="Interactive-Use-of-Restarts.html" rel="next" title="Interactive Use of Restarts"> |
| 16 |
<link href="Resignaling-a-Condition.html" rel="prev" title="Resignaling a Condition"> |
| 17 |
<style type="text/css"> |
| 18 |
<!-- |
| 19 |
a.summary-letter {text-decoration: none} |
| 20 |
blockquote.indentedblock {margin-right: 0em} |
| 21 |
div.display {margin-left: 3.2em} |
| 22 |
div.example {margin-left: 3.2em} |
| 23 |
div.lisp {margin-left: 3.2em} |
| 24 |
kbd {font-style: oblique} |
| 25 |
pre.display {font-family: inherit} |
| 26 |
pre.format {font-family: inherit} |
| 27 |
pre.menu-comment {font-family: serif} |
| 28 |
pre.menu-preformatted {font-family: serif} |
| 29 |
span.nolinebreak {white-space: nowrap} |
| 30 |
span.roman {font-family: initial; font-weight: normal} |
| 31 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| 32 |
ul.no-bullet {list-style: none} |
| 33 |
--> |
| 34 |
</style> |
| 35 |
|
| 36 |
|
| 37 |
</head> |
| 38 |
|
| 39 |
<body lang="en"> |
| 40 |
<span id="Restarts"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="Interactive-Use-of-Restarts.html" accesskey="n" rel="next">Interactive Use of Restarts</a>, Previous: <a href="Resignaling-a-Condition.html" accesskey="p" rel="prev">Resignaling a Condition</a>, Up: <a href="Signaling-and-Handling-Conditions.html" accesskey="u" rel="up">Signaling and Handling Conditions</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="Restarts-1"></span><h4 class="subsubsection">9.1.4.3 Restarts</h4> |
| 46 |
|
| 47 |
<p>The interactive condition handler returns only through |
| 48 |
non-local transfer of control to specially defined <i>restarts</i> |
| 49 |
that can be set up either by the system or by user code. Transferring |
| 50 |
control to a restart is called “invoking” the restart. Like |
| 51 |
handlers, active <i>restarts</i> are <i>established</i> |
| 52 |
dynamically, and |
| 53 |
only active <i>restarts</i> |
| 54 |
can be invoked. An active |
| 55 |
<i>restart</i> can be invoked by the user from |
| 56 |
the debugger or by a program by using <b>invoke-restart</b>. |
| 57 |
</p> |
| 58 |
<p>A <i>restart</i> contains a |
| 59 |
<i>function</i> to be <i>called</i> when the <i>restart</i> is |
| 60 |
invoked, an optional name that can be used to find or invoke the |
| 61 |
<i>restart</i>, and |
| 62 |
an optional set of interaction information for the debugger to use to |
| 63 |
enable the user to manually invoke a <i>restart</i>. |
| 64 |
</p> |
| 65 |
<p>The name of a <i>restart</i> is |
| 66 |
used by <b>invoke-restart</b>. <i>Restarts</i> that can be invoked |
| 67 |
only within the debugger do not need names. |
| 68 |
</p> |
| 69 |
<p><i>Restarts</i> can be established by using <b>restart-bind</b>, |
| 70 |
<b>restart-case</b>, and <b>with-simple-restart</b>. |
| 71 |
A <i>restart</i> function can itself invoke any other <i>restart</i> |
| 72 |
that was active at the time of establishment of the <i>restart</i> |
| 73 |
of which the <i>function</i> is part. |
| 74 |
</p> |
| 75 |
<p>The <i>restarts</i> <i>established</i> by |
| 76 |
a <b>restart-bind</b> <i>form</i>, |
| 77 |
a <b>restart-case</b> <i>form</i>, |
| 78 |
or a <b>with-simple-restart</b> <i>form</i> |
| 79 |
have <i>dynamic extent</i> |
| 80 |
which extends for the duration of that <i>form</i>’s execution. |
| 81 |
</p> |
| 82 |
<p><i>Restarts</i> of the same name can be ordered from least recent to |
| 83 |
most recent according to the following two rules: |
| 84 |
</p> |
| 85 |
<dl compact="compact"> |
| 86 |
<dt>1.</dt> |
| 87 |
<dd><p>Each <i>restart</i> in a set of active restarts |
| 88 |
R_1 is more recent than every <i>restart</i> in a |
| 89 |
set R_2 if the <i>restarts</i> |
| 90 |
in R_2 were active when the <i>restarts</i> in R_1 were |
| 91 |
established. |
| 92 |
</p> |
| 93 |
</dd> |
| 94 |
<dt>2.</dt> |
| 95 |
<dd><p>Let r_1 and r_2 be two active <i>restarts</i> with |
| 96 |
the same name established by the same <i>form</i>. Then r_1 is |
| 97 |
more recent than r_2 if r_1 was defined to the |
| 98 |
left of r_2 in the <i>form</i> that established them. |
| 99 |
</p> |
| 100 |
</dd> |
| 101 |
</dl> |
| 102 |
|
| 103 |
<p>If a <i>restart</i> is invoked but does not transfer control, |
| 104 |
the values resulting from the <i>restart</i> function are |
| 105 |
returned by the function that invoked the restart, either |
| 106 |
<b>invoke-restart</b> or <b>invoke-restart-interactively</b>. |
| 107 |
</p> |
| 108 |
<hr> |
| 109 |
<div class="header"> |
| 110 |
<p> |
| 111 |
Next: <a href="Interactive-Use-of-Restarts.html" accesskey="n" rel="next">Interactive Use of Restarts</a>, Previous: <a href="Resignaling-a-Condition.html" accesskey="p" rel="prev">Resignaling a Condition</a>, Up: <a href="Signaling-and-Handling-Conditions.html" accesskey="u" rel="up">Signaling and Handling Conditions</a> </p> |
| 112 |
</div> |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
</body> |
| 117 |
</html> |