Debian Codegraph @

info/gcl/ensure_002dgeneric_002dfunction.html

raw
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>ensure-generic-function (ANSI and GNU Common Lisp Document)</title>
7
8 <meta name="description" content="ensure-generic-function (ANSI and GNU Common Lisp Document)">
9 <meta name="keywords" content="ensure-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="Objects-Dictionary.html" rel="up" title="Objects Dictionary">
15 <link href="allocate_002dinstance.html" rel="next" title="allocate-instance">
16 <link href="function_002dkeywords.html" rel="prev" title="function-keywords">
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="ensure_002dgeneric_002dfunction"></span><div class="header">
41 <p>
42 Next: <a href="allocate_002dinstance.html" accesskey="n" rel="next">allocate-instance</a>, Previous: <a href="function_002dkeywords.html" accesskey="p" rel="prev">function-keywords</a>, Up: <a href="Objects-Dictionary.html" accesskey="u" rel="up">Objects Dictionary</a> &nbsp; </p>
43 </div>
44 <hr>
45 <span id="ensure_002dgeneric_002dfunction-_005bFunction_005d"></span><h4 class="subsection">7.7.2 ensure-generic-function [Function]</h4>
46
47 <p><code>ensure-generic-function</code> <i>function-name <span class="roman">&amp;key</span>
48 argument-precedence-order declare
49 documentation environment
50 generic-function-class lambda-list
51 method-class method-combination</i><br>
52 &rArr; <i>generic-function</i>
53 </p>
54 <span id="Arguments-and-Values_003a_003a-90"></span><h4 class="subsubheading">Arguments and Values::</h4>
55
56 <p><i>function-name</i>&mdash;a <i>function name</i>.
57 </p>
58 <p>The keyword arguments correspond to the <i>option</i> arguments of
59 <b>defgeneric</b>, except that the <tt>:method-class</tt> and
60 <tt>:generic-function-class</tt> arguments can be <i>class</i> <i>object</i>s
61 as well as names.
62 </p>
63 <p><tt>Method-combination</tt> &ndash; method combination object.
64 </p>
65 <p><tt>Environment</tt> &ndash; the same as the <b>&amp;environment</b> argument
66 to macro expansion functions and is used to distinguish between compile-time
67 and run-time environments.
68 </p>
69 <p>[Editorial Note by KMP: What about documentation. Missing from this arguments enumeration,
70 and confusing in description below.]
71 </p>
72 <p><i>generic-function</i>&mdash;a <i>generic function</i> <i>object</i>.
73 </p>
74 <span id="Description_003a_003a-129"></span><h4 class="subsubheading">Description::</h4>
75
76 <p>The <i>function</i> <b>ensure-generic-function</b> is used to define
77 a globally named <i>generic function</i> with no <i>methods</i>
78 or to specify or modify options and declarations that pertain to
79 a globally named <i>generic function</i> as a whole.
80 </p>
81 <p>If <i>function-name</i> is not <i>fbound</i> in the <i>global environment</i>,
82 a new
83 <i>generic function</i> is created.
84 If
85 </p>
86 <p><tt>(fdefinition <i>function-name</i>)</tt>
87 </p>
88 <p>is an <i>ordinary function</i>,
89 a <i>macro</i>,
90 or a <i>special operator</i>,
91 an error is signaled.
92 </p>
93 <p>If <i>function-name</i>
94 is a <i>list</i>, it must be of the
95 form <tt>(setf <i>symbol</i>)</tt>.
96 If <i>function-name</i> specifies a <i>generic function</i> that has a
97 different value for any of the following arguments,
98 the <i>generic function</i> is modified to have the new value:
99 <tt>:argument-precedence-order</tt>, <tt>:declare</tt>, <tt>:documentation</tt>,
100 <tt>:method-combination</tt>.
101 </p>
102 <p>If <i>function-name</i> specifies a <i>generic function</i> that has a
103 different value for the <tt>:lambda-list</tt> argument, and the new value
104 is congruent with the <i>lambda lists</i> of all existing
105 <i>methods</i> or there
106 are no <i>methods</i>, the value is changed; otherwise an error is signaled.
107 </p>
108 <p>If <i>function-name</i> specifies a <i>generic function</i> that has a
109 different value for the <tt>:generic-function-class</tt> argument and if
110 the new generic function class is compatible with the old,
111 <b>change-class</b> is called to change the <i>class</i> of the
112 <i>generic function</i>;
113 otherwise an error is signaled.
114 </p>
115 <p>If <i>function-name</i> specifies a <i>generic function</i> that has a
116 different value for the <tt>:method-class</tt> argument, the value is
117 changed, but any existing <i>methods</i> are not changed.
118 </p>
119 <span id="Affected-By_003a_003a-10"></span><h4 class="subsubheading">Affected By::</h4>
120
121 <p>Existing function binding of <i>function-name</i>.
122 </p>
123 <span id="Exceptional-Situations_003a_003a-22"></span><h4 class="subsubheading">Exceptional Situations::</h4>
124
125 <p>If
126 </p>
127 <p><tt>(fdefinition <i>function-name</i>)</tt>
128 </p>
129 <p>is an <i>ordinary function</i>, a <i>macro</i>, or a <i>special operator</i>,
130 an error of <i>type</i> <b>error</b> is signaled.
131 </p>
132 <p>If <i>function-name</i> specifies a
133 <i>generic function</i> that has a
134 different value for the <tt>:lambda-list</tt> argument, and the new value
135 is not congruent with the <i>lambda list</i> of any existing
136 <i>method</i>,
137 an error of <i>type</i> <b>error</b> is signaled.
138 </p>
139 <p>If <i>function-name</i> specifies a
140 <i>generic function</i> that has a
141 different value for the <tt>:generic-function-class</tt> argument and if
142 the new generic function class not is compatible with the old,
143 an error of <i>type</i> <b>error</b> is signaled.
144 </p>
145 <span id="See-Also_003a_003a-111"></span><h4 class="subsubheading">See Also::</h4>
146
147 <p><a href="defgeneric.html">defgeneric</a>
148 </p>
149 <hr>
150 <div class="header">
151 <p>
152 Next: <a href="allocate_002dinstance.html" accesskey="n" rel="next">allocate-instance</a>, Previous: <a href="function_002dkeywords.html" accesskey="p" rel="prev">function-keywords</a>, Up: <a href="Objects-Dictionary.html" accesskey="u" rel="up">Objects Dictionary</a> &nbsp; </p>
153 </div>
154
155
156
157 </body>
158 </html>