1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Body/07_fd.htm

39 lines
5.2 KiB
HTML
Raw Normal View History

2024-04-01 10:24:07 +02:00
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
<HTML>
<HEAD>
<TITLE>CLHS: Section 7.6.4</TITLE>
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
<LINK REL=TOP HREF="../Front/index.htm">
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
<LINK REL=PREV HREF="07_fc.htm">
<LINK REL=UP HREF="07_f.htm">
<LINK REL=NEXT HREF="07_fe.htm">
</HEAD>
<BODY>
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="07_fc.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="07_f.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="07_fe.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>
7.6.4 Congruent Lambda-lists for all Methods of a Generic Function</H2> <P>
These rules define the congruence of a set of <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda lists</I></A>, including the <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> of each method for a given generic function and the <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> specified for the generic function itself, if given. <P>
<P><DL><P>
<DT>1. Each <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> must have the same number of required parameters. <P><DD>
<DT>2. Each <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> must have the same number of optional parameters. Each method can supply its own default for an optional parameter. <P><DD>
<DT>3. If any <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> mentions <TT>&amp;rest</TT> or <TT>&amp;key</TT>, each <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> must mention one or both of them. <P><DD>
<DT>4. If the <A REL=DEFINITION HREF="26_glo_g.htm#generic_function"><I>generic function</I></A> <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> 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 name is <TT>:allow-other-keys</TT> and whose value is <A REL=DEFINITION HREF="26_glo_t.htm#true"><I>true</I></A> were supplied, though no such argument pair will be passed. <P><DD>
<DT>5. The use of <TT>&amp;allow-other-keys</TT> need not be consistent across <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda lists</I></A>. If <TT>&amp;allow-other-keys</TT> is mentioned in the <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> of any applicable <A REL=DEFINITION HREF="26_glo_m.htm#method"><I>method</I></A> or of the <A REL=DEFINITION HREF="26_glo_g.htm#generic_function"><I>generic function</I></A>, any keyword arguments may be mentioned in the call to the <A REL=DEFINITION HREF="26_glo_g.htm#generic_function"><I>generic function</I></A>. <P><DD>
<DT>6. The use of <TT>&amp;aux</TT> need not be consistent across methods. <P><DD>
If a <A REL=DEFINITION HREF="26_glo_m.htm#method-defining_operator"><I>method-defining operator</I></A> that cannot specify <A REL=DEFINITION HREF="26_glo_g.htm#generic_function"><I>generic function</I></A> options creates a <A REL=DEFINITION HREF="26_glo_g.htm#generic_function"><I>generic function</I></A>, and if the <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> for the method mentions keyword arguments, the <A REL=DEFINITION HREF="26_glo_l.htm#lambda_list"><I>lambda list</I></A> of the generic function will mention <TT>&amp;key</TT> (but no keyword arguments). <P>
<P></DL><P>
<HR>
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
</BODY>
</HTML>