emacs.d/clones/lisp/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node281.html

71 lines
4.3 KiB
HTML
Raw Normal View History

2022-08-26 19:11:35 +02:00
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>28.1.6.4. Congruent Lambda-Lists for All Methods of a Generic Function</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Congruent Lambda-Lists for All Methods of a Generic Function">
<meta name="keywords" value="clm">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<b>Common Lisp the Language, 2nd Edition</b>
<BR> <HR><A NAME=tex2html5171 HREF="node282.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5169 HREF="node277.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5163 HREF="node280.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5173 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5174 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html5172 HREF="node282.html"> Keyword Arguments in </A>
<B>Up:</B> <A NAME=tex2html5170 HREF="node277.html"> Generic Functions and </A>
<B> Previous:</B> <A NAME=tex2html5164 HREF="node280.html"> Agreement on Parameter </A>
<HR> <P>
<H3><A NAME=SECTION003216400000000000000>28.1.6.4. Congruent Lambda-Lists for All Methods of a Generic Function</A></H3>
<P>
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
<A NAME=CongruentLambdaListsforAllMethodsofaGenericFunctionSECTION>These</A>
rules define the congruence of a set of lambda-lists, including the
lambda-list of each method for a given generic function and the
lambda-list specified for the generic function itself, if given.
<P>
<UL><LI> Each lambda-list must have the same number of required
parameters.
<P>
<LI> Each lambda-list must have the same number of optional
parameters. Each method can supply its own default for an optional
parameter.
<P>
<LI> If any lambda-list mentions <tt>&amp;rest</tt> or <tt>&amp;key</tt>, each
lambda-list must mention one or both of them.
<P>
<LI> If the generic function lambda-list mentions <tt>&amp;key</tt>, each
method must accept all of the keyword names mentioned after <tt>&amp;key</tt>,
either by accepting them explicitly, by specifying
<tt>&amp;allow-other-keys</tt>, or by specifying <tt>&amp;rest</tt> but not <tt>&amp;key</tt>.
Each method can accept additional keyword arguments of its own. The
checking of the validity of keyword names is done in the generic
function, not in each method. A method is invoked as if the keyword
argument pair whose keyword is <tt>:allow-other-keys</tt> and whose value
is <tt>t</tt> were supplied, though no such argument pair will be passed.
<P>
<LI> The use of <tt>&amp;allow-other-keys</tt> need not be consistent
across lambda-lists. If <tt>&amp;allow-other-keys</tt> is mentioned in
the lambda-list of any applicable method or of the generic function,
any keyword arguments may be mentioned in the call to the
generic function.
<P>
<LI> The use of <tt>&amp;aux</tt> need not be consistent across methods.
</UL>
<P>
If a method-defining form that cannot specify generic function options
creates a generic function, and if the lambda-list for the method
mentions keyword arguments, the lambda-list of the generic function
will mention <tt>&amp;key</tt> (but no keyword arguments).
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
<BR> <HR><A NAME=tex2html5171 HREF="node282.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5169 HREF="node277.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5163 HREF="node280.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5173 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5174 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html5172 HREF="node282.html"> Keyword Arguments in </A>
<B>Up:</B> <A NAME=tex2html5170 HREF="node277.html"> Generic Functions and </A>
<B> Previous:</B> <A NAME=tex2html5164 HREF="node280.html"> Agreement on Parameter </A>
<HR> <P>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>