| 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>Congruent Lambda-lists for all Methods of a Generic Function (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="Congruent Lambda-lists for all Methods of a Generic Function (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="Congruent Lambda-lists for all Methods of a Generic Function (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="Generic-Functions-and-Methods.html" rel="up" title="Generic Functions and Methods"> |
| 15 |
<link href="Keyword-Arguments-in-Generic-Functions-and-Methods.html" rel="next" title="Keyword Arguments in Generic Functions and Methods"> |
| 16 |
<link href="Agreement-on-Parameter-Specializers-and-Qualifiers.html" rel="prev" title="Agreement on Parameter Specializers and Qualifiers"> |
| 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="Congruent-Lambda_002dlists-for-all-Methods-of-a-Generic-Function"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="Keyword-Arguments-in-Generic-Functions-and-Methods.html" accesskey="n" rel="next">Keyword Arguments in Generic Functions and Methods</a>, Previous: <a href="Agreement-on-Parameter-Specializers-and-Qualifiers.html" accesskey="p" rel="prev">Agreement on Parameter Specializers and Qualifiers</a>, Up: <a href="Generic-Functions-and-Methods.html" accesskey="u" rel="up">Generic Functions and Methods</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="Congruent-Lambda_002dlists-for-all-Methods-of-a-Generic-Function-1"></span><h4 class="subsection">7.6.4 Congruent Lambda-lists for all Methods of a Generic Function</h4> |
| 46 |
|
| 47 |
<p>These rules define the congruence of a set of <i>lambda lists</i>, including the |
| 48 |
<i>lambda list</i> of each method for a given generic function and the |
| 49 |
<i>lambda list</i> specified for the generic function itself, if given. |
| 50 |
</p> |
| 51 |
<dl compact="compact"> |
| 52 |
<dt>1.</dt> |
| 53 |
<dd><p>Each <i>lambda list</i> must have the same number of required |
| 54 |
parameters. |
| 55 |
</p> |
| 56 |
</dd> |
| 57 |
<dt>2.</dt> |
| 58 |
<dd><p>Each <i>lambda list</i> must have the same number of optional |
| 59 |
parameters. Each method can supply its own default for an optional |
| 60 |
parameter. |
| 61 |
</p> |
| 62 |
</dd> |
| 63 |
<dt>3.</dt> |
| 64 |
<dd><p>If any <i>lambda list</i> mentions <b>&rest</b> or <b>&key</b>, each |
| 65 |
<i>lambda list</i> must mention one or both of them. |
| 66 |
</p> |
| 67 |
</dd> |
| 68 |
<dt>4.</dt> |
| 69 |
<dd><p>If the <i>generic function</i> <i>lambda list</i> |
| 70 |
mentions <b>&key</b>, each |
| 71 |
method must accept all of the keyword names mentioned after <b>&key</b>, |
| 72 |
either by accepting them explicitly, by specifying <b>&allow-other-keys</b>, |
| 73 |
or by specifying <b>&rest</b> but not <b>&key</b>. |
| 74 |
Each method can accept additional keyword arguments of its own. The |
| 75 |
checking of the validity of keyword names is done in the generic |
| 76 |
function, not in each method. |
| 77 |
A method is invoked as if the keyword |
| 78 |
argument pair whose name is <tt>:allow-other-keys</tt> and whose value |
| 79 |
is <i>true</i> were supplied, though no such argument pair will be passed. |
| 80 |
</p> |
| 81 |
</dd> |
| 82 |
<dt>5.</dt> |
| 83 |
<dd><p>The use of <b>&allow-other-keys</b> need not be consistent |
| 84 |
across <i>lambda lists</i>. If <b>&allow-other-keys</b> is mentioned in |
| 85 |
the <i>lambda list</i> of any applicable <i>method</i> or of the <i>generic function</i>, |
| 86 |
any keyword arguments may be mentioned in the call to the <i>generic function</i>. |
| 87 |
</p> |
| 88 |
</dd> |
| 89 |
<dt>6.</dt> |
| 90 |
<dd><p>The use of <b>&aux</b> need not be consistent across methods. |
| 91 |
</p> |
| 92 |
<p>If a <i>method-defining operator</i> that cannot specify <i>generic function</i> options |
| 93 |
creates a <i>generic function</i>, and if the <i>lambda list</i> for the method |
| 94 |
mentions keyword arguments, the <i>lambda list</i> of the generic function |
| 95 |
will mention <b>&key</b> (but no keyword arguments). |
| 96 |
</p> |
| 97 |
</dd> |
| 98 |
</dl> |
| 99 |
|
| 100 |
<hr> |
| 101 |
<div class="header"> |
| 102 |
<p> |
| 103 |
Next: <a href="Keyword-Arguments-in-Generic-Functions-and-Methods.html" accesskey="n" rel="next">Keyword Arguments in Generic Functions and Methods</a>, Previous: <a href="Agreement-on-Parameter-Specializers-and-Qualifiers.html" accesskey="p" rel="prev">Agreement on Parameter Specializers and Qualifiers</a>, Up: <a href="Generic-Functions-and-Methods.html" accesskey="u" rel="up">Generic Functions and Methods</a> </p> |
| 104 |
</div> |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
</body> |
| 109 |
</html> |