1
0
Fork 0
cl-sites/novaspec.org/cl/f_defclass.html
2025-02-05 18:52:26 +01:00

1959 lines
No EOL
42 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>defclass | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_defclass.html"
><LINK REL="next" HREF="f_defgeneric.html" TYPE="text/html" TITLE="defgeneric"
><LINK REL="prev" HREF="f_with-slots.html" TYPE="text/html" TITLE="with-slots"
><LINK REL="up" HREF="7_7_Objects_Dictionary.html" TYPE="text/html" TITLE="7.7 Objects Dictionary"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="7_Objects.html"
>7. Objects</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="7_7_Objects_Dictionary.html"
>7.7 Objects Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="f_defclass.html"
>defclass</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="f_with-slots.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="f_defgeneric.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><DIV CLASS="com"
><DIV CLASS="begincom"
><HR
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="defclass"
></SPAN
><B
>defclass</B
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Macro</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Syntax</B
></DT
><DD
><DIV CLASS="DefmacWithValuesNewline"
><DIV
><B
>defclass</B
> <VAR CLASS="param"
>class-name</VAR
> <SPAN CLASS="cmr"
>(</SPAN
><SPAN CLASS="cmsy"
>{</SPAN
><VAR CLASS="param"
>superclass-name</VAR
><SPAN CLASS="cmsy"
>}</SPAN
><SPAN CLASS="cmr"
>*)</SPAN
> <SPAN CLASS="cmr"
>(</SPAN
><SPAN CLASS="cmsy"
>{</SPAN
><I CLASS="i"
><I
>slot-specifier</I
></I
><SPAN CLASS="cmsy"
>}</SPAN
><SPAN CLASS="cmr"
>*)</SPAN
> <SPAN CLASS="cmr"
>&#10214;&#8201;</SPAN
><SPAN CLASS="cmsy"
>&#8595;</SPAN
><I CLASS="i"
><I
>class-option</I
></I
>&#8201;<SPAN CLASS="cmr"
>&#8201;&#10215;</SPAN
> </DIV
><DIV
><SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> <SPAN CLASS="cmssi"
>new-class</SPAN
></DIV
></DIV
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0"
><TBODY
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
><VAR CLASS="param"
>slot-specifier</VAR
><SPAN CLASS="cmssi"
>::</SPAN
><SPAN CLASS="cmr"
>=</SPAN
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmsy"
>&#8595;</SPAN
><VAR CLASS="param"
>slot-name</VAR
> <SPAN CLASS="cmsy"
>|</SPAN
> <SPAN CLASS="cmr"
>(</SPAN
><SPAN CLASS="cmsy"
>&#8595;</SPAN
><VAR CLASS="param"
>slot-name</VAR
> <SPAN CLASS="cmr"
>&#10214;&#8201;</SPAN
><SPAN CLASS="cmsy"
>&#8595;</SPAN
><VAR CLASS="param"
>slot-option</VAR
>&#8201;<SPAN CLASS="cmr"
>&#8201;&#10215;</SPAN
><SPAN CLASS="cmr"
>)</SPAN
></TD
></TR
></TBODY
></TABLE
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0"
><TBODY
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
><VAR CLASS="param"
>slot-name</VAR
><SPAN CLASS="cmssi"
>::</SPAN
><SPAN CLASS="cmr"
>=</SPAN
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
></TD
></TR
></TBODY
></TABLE
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0"
><TBODY
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
><VAR CLASS="param"
>slot-option</VAR
><SPAN CLASS="cmssi"
>::</SPAN
><SPAN CLASS="cmr"
>=</SPAN
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmsy"
>{</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:reader</SPAN
></SPAN
> <VAR CLASS="param"
>reader-function-name</VAR
><SPAN CLASS="cmsy"
>}</SPAN
><SPAN CLASS="cmr"
>*</SPAN
> <SPAN CLASS="cmsy"
>|</SPAN
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmsy"
>{</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:writer</SPAN
></SPAN
> <VAR CLASS="param"
>writer-function-name</VAR
><SPAN CLASS="cmsy"
>}</SPAN
><SPAN CLASS="cmr"
>*</SPAN
> <SPAN CLASS="cmsy"
>|</SPAN
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmsy"
>{</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:accessor</SPAN
></SPAN
> <VAR CLASS="param"
>reader-function-name</VAR
><SPAN CLASS="cmsy"
>}</SPAN
><SPAN CLASS="cmr"
>*</SPAN
> <SPAN CLASS="cmsy"
>|</SPAN
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmsy"
>{</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:allocation</SPAN
></SPAN
> <VAR CLASS="param"
>allocation-type</VAR
><SPAN CLASS="cmsy"
>}</SPAN
> <SPAN CLASS="cmsy"
>|</SPAN
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmsy"
>{</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:initarg</SPAN
></SPAN
> <VAR CLASS="param"
>initarg-name</VAR
><SPAN CLASS="cmsy"
>}</SPAN
><SPAN CLASS="cmr"
>*</SPAN
> <SPAN CLASS="cmsy"
>|</SPAN
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmsy"
>{</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:initform</SPAN
></SPAN
> <VAR CLASS="param"
>form</VAR
><SPAN CLASS="cmsy"
>}</SPAN
> <SPAN CLASS="cmsy"
>|</SPAN
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmsy"
>{</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:type</SPAN
></SPAN
> <VAR CLASS="param"
>type-specifier</VAR
><SPAN CLASS="cmsy"
>}</SPAN
> <SPAN CLASS="cmsy"
>|</SPAN
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmsy"
>{</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:documentation</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#string"
><EM CLASS="term"
>string</EM
></A
><SPAN CLASS="cmsy"
>}</SPAN
></TD
></TR
></TBODY
></TABLE
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0"
><TBODY
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
><VAR CLASS="param"
>function-name</VAR
><SPAN CLASS="cmssi"
>::</SPAN
><SPAN CLASS="cmr"
>=</SPAN
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> <SPAN CLASS="cmsy"
>|</SPAN
> <SPAN CLASS="cmr"
>(</SPAN
><SPAN CLASS="cmtt"
>setf</SPAN
> <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
><SPAN CLASS="cmr"
>)</SPAN
></TD
></TR
></TBODY
></TABLE
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0"
><TBODY
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
><VAR CLASS="param"
>class-option</VAR
><SPAN CLASS="cmssi"
>::</SPAN
><SPAN CLASS="cmr"
>=</SPAN
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmr"
>(</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:default-initargs</SPAN
></SPAN
> <CODE CLASS="f"
>.</CODE
> <VAR CLASS="param"
>initarg-list</VAR
><SPAN CLASS="cmr"
>)</SPAN
> <SPAN CLASS="cmsy"
>|</SPAN
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmr"
>(</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:documentation</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#string"
><EM CLASS="term"
>string</EM
></A
><SPAN CLASS="cmr"
>)</SPAN
> <SPAN CLASS="cmsy"
>|</SPAN
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
> <SPAN CLASS="cmr"
>(</SPAN
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:metaclass</SPAN
></SPAN
> <VAR CLASS="param"
>class-name</VAR
><SPAN CLASS="cmr"
>)</SPAN
></TD
></TR
></TBODY
></TABLE
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>Class-name</VAR
> &#8212; a <A HREF="26_1_Glossary.html#non-nil"
><EM CLASS="term"
>non-nil</EM
></A
> <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Superclass-name</VAR
> &#8212; a <A HREF="26_1_Glossary.html#non-nil"
><EM CLASS="term"
>non-nil</EM
></A
> <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Slot-name</VAR
> &#8212; a <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
>. The <VAR CLASS="param"
>slot-name</VAR
> argument is a <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> that is syntactically valid for use as a variable name. </P
><P CLASS="j"
><VAR CLASS="param"
>Reader-function-name</VAR
> &#8212; a <A HREF="26_1_Glossary.html#non-nil"
><EM CLASS="term"
>non-nil</EM
></A
> <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
>. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:reader</SPAN
></SPAN
> can be supplied more than once for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Writer-function-name</VAR
> &#8212; a <A HREF="26_1_Glossary.html#generic_function"
><EM CLASS="term"
>generic function</EM
></A
> name. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:writer</SPAN
></SPAN
> can be supplied more than once for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Reader-function-name</VAR
> &#8212; a <A HREF="26_1_Glossary.html#non-nil"
><EM CLASS="term"
>non-nil</EM
></A
> <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
>. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:accessor</SPAN
></SPAN
> can be supplied more than once for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Allocation-type</VAR
> &#8212; (member <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:instance</SPAN
></SPAN
> <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:class</SPAN
></SPAN
>). <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:allocation</SPAN
></SPAN
> can be supplied once at most for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Initarg-name</VAR
> &#8212; a <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
>. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:initarg</SPAN
></SPAN
> can be supplied more than once for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Form</VAR
> &#8212; a <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
>. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:init-form</SPAN
></SPAN
> can be supplied once at most for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Type-specifier</VAR
> &#8212; a <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifier</EM
></A
>. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:type</SPAN
></SPAN
> can be supplied once at most for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Class-option</VAR
> &#8212; refers to the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> as a whole or to all class <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>Initarg-list</VAR
> &#8212; a <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>list</EM
></A
> of alternating initialization argument <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>names</EM
></A
> and default initial value <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>forms</EM
></A
>. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:default-initargs</SPAN
></SPAN
> can be supplied at most once. </P
><P CLASS="j"
><VAR CLASS="param"
>Class-name</VAR
> &#8212; a <A HREF="26_1_Glossary.html#non-nil"
><EM CLASS="term"
>non-nil</EM
></A
> <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
>. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:metaclass</SPAN
></SPAN
> can be supplied once at most. </P
><P CLASS="j"
><VAR CLASS="param"
>new-class</VAR
> &#8212; the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
>The macro <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> defines a new named <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. It returns the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> as its result. </P
><P CLASS="j"
>The syntax of <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> provides options for specifying initialization arguments for <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
>, for specifying default initialization values for <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
>, and for requesting that <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
> on specified <A HREF="26_1_Glossary.html#generic_function"
><EM CLASS="term"
>generic functions</EM
></A
> be automatically generated for reading and writing the values of <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
>. No reader or writer functions are defined by default; their generation must be explicitly requested. However, <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> can always be <A HREF="26_1_Glossary.html#access"
><EM CLASS="term"
>accessed</EM
></A
> using <A HREF="f_slot-value.html" CLASS="funref"
><B
>slot-value</B
></A
>. </P
><P CLASS="j"
>Defining a new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> also causes a <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> of the same name to be defined. The predicate <CODE CLASS="f"
>(typep <VAR CLASS="param"
>object</VAR
> <VAR CLASS="param"
>class-name</VAR
>)</CODE
> returns true if the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> of the given <VAR CLASS="param"
>object</VAR
> is the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> named by <VAR CLASS="param"
>class-name</VAR
> itself or a subclass of the class <VAR CLASS="param"
>class-name</VAR
>. A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> can be used as a <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifier</EM
></A
>. Thus <CODE CLASS="f"
>(typep <VAR CLASS="param"
>object</VAR
> <VAR CLASS="param"
>class</VAR
>)</CODE
> returns <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
> if the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> of the <VAR CLASS="param"
>object</VAR
> is <VAR CLASS="param"
>class</VAR
> itself or a subclass of <VAR CLASS="param"
>class</VAR
>. </P
><P CLASS="j"
>The <VAR CLASS="param"
>class-name</VAR
> argument specifies the <A HREF="26_1_Glossary.html#proper_name"
><EM CLASS="term"
>proper name</EM
></A
> of the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. If a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> with the same <A HREF="26_1_Glossary.html#proper_name"
><EM CLASS="term"
>proper name</EM
></A
> already exists and that <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is an <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> of <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
>, and if the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form for the definition of the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> specifies a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
>, the existing <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is redefined, and instances of it (and its <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclasses</EM
></A
>) are updated to the new definition at the time that they are next <A HREF="26_1_Glossary.html#access"
><EM CLASS="term"
>accessed</EM
></A
>. For details, see <A HREF="4_3_Classes.html#sec_4_3_6" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>4.3.6</SPAN
> <SPAN CLASS="cmr"
>(Redefining</SPAN
> <SPAN CLASS="cmr"
>Classes)</SPAN
></A
>. </P
><P CLASS="j"
>Each <VAR CLASS="param"
>superclass-name</VAR
> argument specifies a direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> of the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. If the <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> list is empty, then the <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> defaults depending on the <A HREF="26_1_Glossary.html#metaclass"
><EM CLASS="term"
>metaclass</EM
></A
>, with <A HREF="t_standard-object.html" CLASS="typeref"
><B
>standard-object</B
></A
> being the default for <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
>. </P
><P CLASS="j"
>The new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> will inherit <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> and <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
> from each of its direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>, from their direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>, and so on. For a discussion of how <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> and <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
> are inherited, see <A HREF="4_3_Classes.html#sec_4_3_4" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>4.3.4</SPAN
> <SPAN CLASS="cmr"
>(Inheritance)</SPAN
></A
>. </P
><P CLASS="j"
>The following slot options are available:</P
><DL
><DT
><SPAN CLASS="cmsy"
>&#8226;</SPAN
></DT
><DD
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:reader</SPAN
></SPAN
> slot option specifies that an <A HREF="26_1_Glossary.html#unqualified_method"
><EM CLASS="term"
>unqualified method</EM
></A
> is to be defined on the <A HREF="26_1_Glossary.html#generic_function"
><EM CLASS="term"
>generic function</EM
></A
> named <VAR CLASS="param"
>reader-function-name</VAR
> to read the value of the given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>.</P
></DD
><DT
><SPAN CLASS="cmsy"
>&#8226;</SPAN
></DT
><DD
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:writer</SPAN
></SPAN
> slot option specifies that an <A HREF="26_1_Glossary.html#unqualified_method"
><EM CLASS="term"
>unqualified method</EM
></A
> is to be defined on the <A HREF="26_1_Glossary.html#generic_function"
><EM CLASS="term"
>generic function</EM
></A
> named <VAR CLASS="param"
>writer-function-name</VAR
> to write the value of the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>.</P
></DD
><DT
><SPAN CLASS="cmsy"
>&#8226;</SPAN
></DT
><DD
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:accessor</SPAN
></SPAN
> slot option specifies that an <A HREF="26_1_Glossary.html#unqualified_method"
><EM CLASS="term"
>unqualified method</EM
></A
> is to be defined on the generic function named <VAR CLASS="param"
>reader-function-name</VAR
> to read the value of the given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> and that an <A HREF="26_1_Glossary.html#unqualified_method"
><EM CLASS="term"
>unqualified method</EM
></A
> is to be defined on the <A HREF="26_1_Glossary.html#generic_function"
><EM CLASS="term"
>generic function</EM
></A
> named <CODE CLASS="f"
>(setf <VAR CLASS="param"
>reader-function-name</VAR
>)</CODE
> to be used with <A HREF="f_setf.html" CLASS="macref"
><B
>setf</B
></A
> to modify the value of the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>.</P
></DD
><DT
><SPAN CLASS="cmsy"
>&#8226;</SPAN
></DT
><DD
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:allocation</SPAN
></SPAN
> slot option is used to specify where storage is to be allocated for the given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. Storage for a <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> can be located in each instance or in the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> itself. The value of the <VAR CLASS="param"
>allocation-type</VAR
> argument can be either the keyword <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:instance</SPAN
></SPAN
> or the keyword <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:class</SPAN
></SPAN
>. If the <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:allocation</SPAN
></SPAN
> slot option is not specified, the effect is the same as specifying <CODE CLASS="f"
>:allocation :instance</CODE
>.</P
><UL
><LI
><P CLASS="j"
>If <VAR CLASS="param"
>allocation-type</VAR
> is <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:instance</SPAN
></SPAN
>, a <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slot</EM
></A
> of the name <VAR CLASS="param"
>slot-name</VAR
> is allocated in each instance of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>.</P
></LI
><LI
><P CLASS="j"
>If <VAR CLASS="param"
>allocation-type</VAR
> is <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:class</SPAN
></SPAN
>, a shared <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> of the given name is allocated in the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> created by this <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form. The value of the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> is shared by all <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. If a class <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> defines such a <A HREF="26_1_Glossary.html#shared_slot"
><EM CLASS="term"
>shared slot</EM
></A
>, any subclass <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> of <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> will share this single <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> unless the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form for <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> specifies a <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> of the same <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> or there is a superclass of <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> that precedes <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> in the class precedence list of <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> and that defines a <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> of the same <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
>.</P
></LI
></UL
></DD
><DT
><SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:initform</SPAN
></SPAN
></DT
><DD
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:initform</SPAN
></SPAN
> slot option is used to provide a default initial value form to be used in the initialization of the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. This <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
> is evaluated every time it is used to initialize the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. The lexical environment in which this <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
> is evaluated is the lexical environment in which the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form was evaluated. Note that the lexical environment refers both to variables and to functions. For <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
>, the dynamic environment is the dynamic environment in which <A HREF="f_make-instance.html" CLASS="funref"
><B
>make-instance</B
></A
> is called; for shared <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
>, the dynamic environment is the dynamic environment in which the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form was evaluated. See <A HREF="7_1_Object_Creation_and_Initialization.html#sec_7_1" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>7.1</SPAN
> <SPAN CLASS="cmr"
>(Object</SPAN
> <SPAN CLASS="cmr"
>Creation</SPAN
> <SPAN CLASS="cmr"
>and</SPAN
> <SPAN CLASS="cmr"
>Initialization)</SPAN
></A
>. </P
><P CLASS="j"
>No implementation is permitted to extend the syntax of <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> to allow <CODE CLASS="f"
>(<VAR CLASS="param"
>slot-name</VAR
> <VAR CLASS="param"
>form</VAR
>)</CODE
> as an abbreviation for <CODE CLASS="f"
>(<VAR CLASS="param"
>slot-name</VAR
> :initform <VAR CLASS="param"
>form</VAR
>)</CODE
>.</P
></DD
><DT
><SPAN CLASS="cmsy"
>&#8226;</SPAN
></DT
><DD
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:initarg</SPAN
></SPAN
> slot option declares an initialization argument named <VAR CLASS="param"
>initarg-name</VAR
> and specifies that this initialization argument initializes the given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. If the initialization argument has a value in the call to <A HREF="f_initialize-instance.html" CLASS="funref"
><B
>initialize-instance</B
></A
>, the value will be stored into the given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>, and the slot&#8217;s <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:initform</SPAN
></SPAN
> slot option, if any, is not evaluated. If none of the initialization arguments specified for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> has a value, the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> is initialized according to the <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:initform</SPAN
></SPAN
> slot option, if specified.</P
></DD
><DT
><SPAN CLASS="cmsy"
>&#8226;</SPAN
></DT
><DD
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:type</SPAN
></SPAN
> slot option specifies that the contents of the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> will always be of the specified data type. It effectively declares the result type of the reader generic function when applied to an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> of this <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. The consequences of attempting to store in a <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> a value that does not satisfy the type of the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> are undefined. The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:type</SPAN
></SPAN
> slot option is further discussed in <A HREF="7_5_Slots.html#sec_7_5_3" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>7.5.3</SPAN
> <SPAN CLASS="cmr"
>(Inheritance</SPAN
> <SPAN CLASS="cmr"
>of</SPAN
> <SPAN CLASS="cmr"
>Slots</SPAN
> <SPAN CLASS="cmr"
>and</SPAN
> <SPAN CLASS="cmr"
>Slot</SPAN
> <SPAN CLASS="cmr"
>Options)</SPAN
></A
>.</P
></DD
><DT
><SPAN CLASS="cmsy"
>&#8226;</SPAN
></DT
><DD
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:documentation</SPAN
></SPAN
> slot option provides a <A HREF="26_1_Glossary.html#documentation_string"
><EM CLASS="term"
>documentation string</EM
></A
> for the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:documentation</SPAN
></SPAN
> can be supplied once at most for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>.</P
></DD
></DL
><P CLASS="j"
>Each class option is an option that refers to the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> as a whole. The following class options are available:</P
><UL
><LI
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:default-initargs</SPAN
></SPAN
> class option is followed by a list of alternating initialization argument <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>names</EM
></A
> and default initial value forms. If any of these initialization arguments does not appear in the initialization argument list supplied to <A HREF="f_make-instance.html" CLASS="funref"
><B
>make-instance</B
></A
>, the corresponding default initial value form is evaluated, and the initialization argument <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> and the <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
>&#8217;s value are added to the end of the initialization argument list before the instance is created; see <A HREF="7_1_Object_Creation_and_Initialization.html#sec_7_1" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>7.1</SPAN
> <SPAN CLASS="cmr"
>(Object</SPAN
> <SPAN CLASS="cmr"
>Creation</SPAN
> <SPAN CLASS="cmr"
>and</SPAN
> <SPAN CLASS="cmr"
>Initialization)</SPAN
></A
>. The default initial value form is evaluated each time it is used. The lexical environment in which this <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
> is evaluated is the lexical environment in which the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form was evaluated. The dynamic environment is the dynamic environment in which <A HREF="f_make-instance.html" CLASS="funref"
><B
>make-instance</B
></A
> was called. If an initialization argument <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> appears more than once in a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:default-initargs</SPAN
></SPAN
> class option, an error is signaled.</P
></LI
><LI
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:documentation</SPAN
></SPAN
> class option causes a <A HREF="26_1_Glossary.html#documentation_string"
><EM CLASS="term"
>documentation string</EM
></A
> to be attached with the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>, and attached with kind <A HREF="m_type.html" CLASS="misc"
><B
>type</B
></A
> to the <VAR CLASS="param"
>class-name</VAR
>. <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:documentation</SPAN
></SPAN
> can be supplied once at most.</P
></LI
><LI
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:metaclass</SPAN
></SPAN
> class option is used to specify that instances of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> being defined are to have a different metaclass than the default provided by the system (the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
>).</P
></LI
></UL
><P CLASS="j"
>Note the following rules of <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> for <A HREF="26_1_Glossary.html#standard_class"
><EM CLASS="term"
>standard classes</EM
></A
>:</P
><UL
><LI
><P CLASS="j"
>It is not required that the <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> of a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> be defined before the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form for that <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is evaluated.</P
></LI
><LI
><P CLASS="j"
>All the <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> of a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> must be defined before an <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> can be made.</P
></LI
><LI
><P CLASS="j"
>A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> must be defined before it can be used as a parameter specializer in a <A HREF="f_defmethod.html" CLASS="macref"
><B
>defmethod</B
></A
> form.</P
></LI
></UL
><P CLASS="j"
>The object system can be extended to cover situations where these rules are not obeyed. </P
><P CLASS="j"
>Some slot options are inherited by a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> from its <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>, and some can be shadowed or altered by providing a local slot description. No class options except <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:default-initargs</SPAN
></SPAN
> are inherited. For a detailed description of how <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> and slot options are inherited, see <A HREF="7_5_Slots.html#sec_7_5_3" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>7.5.3</SPAN
> <SPAN CLASS="cmr"
>(Inheritance</SPAN
> <SPAN CLASS="cmr"
>of</SPAN
> <SPAN CLASS="cmr"
>Slots</SPAN
> <SPAN CLASS="cmr"
>and</SPAN
> <SPAN CLASS="cmr"
>Slot</SPAN
> <SPAN CLASS="cmr"
>Options)</SPAN
></A
>. </P
><P CLASS="j"
>The options to <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> can be extended. It is required that all implementations signal an error if they observe a class option or a slot option that is not implemented locally. </P
><P CLASS="j"
>It is valid to specify more than one reader, writer, accessor, or initialization argument for a <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. No other slot option can appear more than once in a single slot description, or an error is signaled. </P
><P CLASS="j"
>If no reader, writer, or accessor is specified for a <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>, the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> can only be <A HREF="26_1_Glossary.html#access"
><EM CLASS="term"
>accessed</EM
></A
> by the <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> <A HREF="f_slot-value.html" CLASS="funref"
><B
>slot-value</B
></A
>. </P
><P CLASS="j"
>If a <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
> appears as a <A HREF="26_1_Glossary.html#top_level_form"
><EM CLASS="term"
>top level form</EM
></A
>, the <A HREF="26_1_Glossary.html#compiler"
><EM CLASS="term"
>compiler</EM
></A
> must make the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> be recognized as a valid <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> in subsequent declarations (as for <A HREF="f_deftype.html" CLASS="macref"
><B
>deftype</B
></A
>) and be recognized as a valid <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> for <A HREF="f_defmethod.html" CLASS="macref"
><B
>defmethod</B
></A
> <A HREF="26_1_Glossary.html#parameter_specializer"
><EM CLASS="term"
>parameter specializers</EM
></A
> and for use as the <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:metaclass</SPAN
></SPAN
> option of a subsequent <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
>. The <A HREF="26_1_Glossary.html#compiler"
><EM CLASS="term"
>compiler</EM
></A
> must make the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> definition available to be returned by <A HREF="f_find-class.html" CLASS="funref"
><B
>find-class</B
></A
> when its <VAR CLASS="param"
>environment</VAR
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> is a value received as the <A HREF="26_1_Glossary.html#environment_parameter"
><EM CLASS="term"
>environment parameter</EM
></A
> of a <A HREF="26_1_Glossary.html#macro"
><EM CLASS="term"
>macro</EM
></A
>.</P
></DD
><DT
><B
>Exceptional Situations</B
></DT
><DD
><P CLASS="j"
>If there are any duplicate slot names, an error of <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="t_program-error.html" CLASS="typeref"
><B
>program-error</B
></A
> is signaled. </P
><P CLASS="j"
>If an initialization argument <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> appears more than once in <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:default-initargs</SPAN
></SPAN
> class option, an error of <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="t_program-error.html" CLASS="typeref"
><B
>program-error</B
></A
> is signaled. </P
><P CLASS="j"
>If any of the following slot options appears more than once in a single slot description, an error of <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="t_program-error.html" CLASS="typeref"
><B
>program-error</B
></A
> is signaled: <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:allocation</SPAN
></SPAN
>, <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:initform</SPAN
></SPAN
>, <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:type</SPAN
></SPAN
>, <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:documentation</SPAN
></SPAN
>. </P
><P CLASS="j"
>It is required that all implementations signal an error of <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="t_program-error.html" CLASS="typeref"
><B
>program-error</B
></A
> if they observe a class option or a slot option that is not implemented locally.</P
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_documentation.html" CLASS="funref"
><B
>documentation</B
></A
>, <A HREF="f_initialize-instance.html" CLASS="funref"
><B
>initialize-instance</B
></A
>, <A HREF="f_make-instance.html" CLASS="funref"
><B
>make-instance</B
></A
>, <A HREF="f_slot-value.html" CLASS="funref"
><B
>slot-value</B
></A
>, <A HREF="4_3_Classes.html#sec_4_3" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>4.3</SPAN
> <SPAN CLASS="cmr"
>(Classes)</SPAN
></A
>, <A HREF="4_3_Classes.html#sec_4_3_4" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>4.3.4</SPAN
> <SPAN CLASS="cmr"
>(Inheritance)</SPAN
></A
>, <A HREF="4_3_Classes.html#sec_4_3_6" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>4.3.6</SPAN
> <SPAN CLASS="cmr"
>(Redefining</SPAN
> <SPAN CLASS="cmr"
>Classes)</SPAN
></A
>, <A HREF="4_3_Classes.html#sec_4_3_5" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>4.3.5</SPAN
> <SPAN CLASS="cmr"
>(Determining</SPAN
> <SPAN CLASS="cmr"
>the</SPAN
> <SPAN CLASS="cmr"
>Class</SPAN
> <SPAN CLASS="cmr"
>Precedence</SPAN
> <SPAN CLASS="cmr"
>List)</SPAN
></A
>, <A HREF="7_1_Object_Creation_and_Initialization.html#sec_7_1" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>7.1</SPAN
> <SPAN CLASS="cmr"
>(Object</SPAN
> <SPAN CLASS="cmr"
>Creation</SPAN
> <SPAN CLASS="cmr"
>and</SPAN
> <SPAN CLASS="cmr"
>Initialization)</SPAN
></A
></P
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="f_with-slots.html" CLASS="prev"
>&#8592;</A
><A HREF="f_defgeneric.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>