| 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>call-next-method (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="call-next-method (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="call-next-method (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="Objects-Dictionary.html" rel="up" title="Objects Dictionary"> |
| 15 |
<link href="compute_002dapplicable_002dmethods.html" rel="next" title="compute-applicable-methods"> |
| 16 |
<link href="call_002dmethod.html" rel="prev" title="call-method"> |
| 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="call_002dnext_002dmethod"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="compute_002dapplicable_002dmethods.html" accesskey="n" rel="next">compute-applicable-methods</a>, Previous: <a href="call_002dmethod.html" accesskey="p" rel="prev">call-method</a>, Up: <a href="Objects-Dictionary.html" accesskey="u" rel="up">Objects Dictionary</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="call_002dnext_002dmethod-_005bLocal-Function_005d"></span><h4 class="subsection">7.7.31 call-next-method [Local Function]</h4> |
| 46 |
|
| 47 |
<span id="Syntax_003a_003a-29"></span><h4 class="subsubheading">Syntax::</h4> |
| 48 |
|
| 49 |
<p><code>call-next-method</code> <i><span class="roman">&rest</span> args</i> ⇒ <i>{<i>result</i>}*</i> |
| 50 |
</p> |
| 51 |
<span id="Arguments-and-Values_003a_003a-119"></span><h4 class="subsubheading">Arguments and Values::</h4> |
| 52 |
|
| 53 |
<p><i>arg</i>—an <i>object</i>. |
| 54 |
</p> |
| 55 |
<p><i>results</i>—the <i>values</i> returned by the <i>method</i> it calls. |
| 56 |
</p> |
| 57 |
<span id="Description_003a_003a-158"></span><h4 class="subsubheading">Description::</h4> |
| 58 |
|
| 59 |
<p>The <i>function</i> <b>call-next-method</b> can be used |
| 60 |
</p> |
| 61 |
<p>within the body <i>forms</i> (but not the <i>lambda list</i>) |
| 62 |
</p> |
| 63 |
<p>of a <i>method</i> defined by a <i>method-defining form</i> to call the |
| 64 |
<i>next method</i>. |
| 65 |
</p> |
| 66 |
<p>If there is no next <i>method</i>, the generic function |
| 67 |
<b>no-next-method</b> is called. |
| 68 |
</p> |
| 69 |
<p>The type of method combination used determines which <i>methods</i> |
| 70 |
can invoke <b>call-next-method</b>. The standard |
| 71 |
<i>method combination</i> type allows <b>call-next-method</b> |
| 72 |
to be used within primary <i>methods</i> and <i>around methods</i>. |
| 73 |
For generic functions using a type of method combination defined by |
| 74 |
the short form of <b>define-method-combination</b>, |
| 75 |
<b>call-next-method</b> can be used in <i>around methods</i> only. |
| 76 |
</p> |
| 77 |
<p>When <b>call-next-method</b> is called with no arguments, it passes the |
| 78 |
current <i>method</i>’s original arguments to the next <i>method</i>. Neither |
| 79 |
argument defaulting, nor using <b>setq</b>, nor rebinding variables |
| 80 |
with the same <i>names</i> as parameters of the <i>method</i> affects the values |
| 81 |
<b>call-next-method</b> passes to the <i>method</i> it calls. |
| 82 |
</p> |
| 83 |
<p>When <b>call-next-method</b> is called with arguments, the |
| 84 |
<i>next method</i> is called with those arguments. |
| 85 |
</p> |
| 86 |
<p>If <b>call-next-method</b> is called with arguments but omits |
| 87 |
optional arguments, the <i>next method</i> called defaults those arguments. |
| 88 |
</p> |
| 89 |
<p>The <i>function</i> <b>call-next-method</b> returns any <i>values</i> that are |
| 90 |
returned by the <i>next method</i>. |
| 91 |
</p> |
| 92 |
<p>The <i>function</i> <b>call-next-method</b> has <i>lexical scope</i> and |
| 93 |
<i>indefinite extent</i> and can only be used within the body of a |
| 94 |
<i>method</i> defined by a <i>method-defining form</i>. |
| 95 |
</p> |
| 96 |
<p>Whether or not <b>call-next-method</b> is <i>fbound</i> in the |
| 97 |
<i>global environment</i> is <i>implementation-dependent</i>; |
| 98 |
however, the restrictions on redefinition and <i>shadowing</i> of |
| 99 |
<b>call-next-method</b> are the same as for <i>symbols</i> in the <tt>COMMON-LISP</tt> <i>package</i> |
| 100 |
which are <i>fbound</i> in the <i>global environment</i>. |
| 101 |
The consequences of attempting to use <b>call-next-method</b> outside |
| 102 |
of a <i>method-defining form</i> are undefined. |
| 103 |
</p> |
| 104 |
<span id="Affected-By_003a_003a-15"></span><h4 class="subsubheading">Affected By::</h4> |
| 105 |
|
| 106 |
<p><b>defmethod</b>, <b>call-method</b>, <b>define-method-combination</b>. |
| 107 |
</p> |
| 108 |
<span id="Exceptional-Situations_003a_003a-41"></span><h4 class="subsubheading">Exceptional Situations::</h4> |
| 109 |
|
| 110 |
<p>When providing arguments to <b>call-next-method</b>, |
| 111 |
the following rule must be satisfied or an error of <i>type</i> <b>error</b> |
| 112 |
should be |
| 113 |
signaled: |
| 114 |
the ordered set of <i>applicable methods</i> for a changed set of arguments |
| 115 |
for <b>call-next-method</b> must be the same as the ordered set of |
| 116 |
<i>applicable methods</i> for the original arguments to the |
| 117 |
<i>generic function</i>. |
| 118 |
Optimizations of the error checking are possible, but they must not change |
| 119 |
the semantics of <b>call-next-method</b>. |
| 120 |
</p> |
| 121 |
<span id="See-Also_003a_003a-140"></span><h4 class="subsubheading">See Also::</h4> |
| 122 |
|
| 123 |
<p><a href="define_002dmethod_002dcombination.html">define-method-combination</a> |
| 124 |
, |
| 125 |
<a href="defmethod.html">defmethod</a> |
| 126 |
, |
| 127 |
<a href="next_002dmethod_002dp.html">next-method-p</a> |
| 128 |
, |
| 129 |
<a href="no_002dnext_002dmethod.html">no-next-method</a> |
| 130 |
, |
| 131 |
<a href="call_002dmethod.html">call-method</a> |
| 132 |
, |
| 133 |
<a href="Method-Selection-and-Combination.html">Method Selection and Combination</a>, |
| 134 |
<a href="Standard-Method-Combination.html">Standard Method Combination</a>, |
| 135 |
<a href="Built_002din-Method-Combination-Types.html">Built-in Method Combination Types</a> |
| 136 |
</p> |
| 137 |
<hr> |
| 138 |
<div class="header"> |
| 139 |
<p> |
| 140 |
Next: <a href="compute_002dapplicable_002dmethods.html" accesskey="n" rel="next">compute-applicable-methods</a>, Previous: <a href="call_002dmethod.html" accesskey="p" rel="prev">call-method</a>, Up: <a href="Objects-Dictionary.html" accesskey="u" rel="up">Objects Dictionary</a> </p> |
| 141 |
</div> |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
</body> |
| 146 |
</html> |