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

4774 lines
No EOL
110 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>4.3 Classes | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="4_3_Classes.html"
><LINK REL="next" HREF="4_4_Types_and_Classes_Dictionary.html" TYPE="text/html" TITLE="4.4 Types and Classes Dictionary"
><LINK REL="prev" HREF="4_2_Types.html" TYPE="text/html" TITLE="4.2 Types"
><LINK REL="up" HREF="4_Types_and_Classes.html" TYPE="text/html" TITLE="4. Types and Classes"
><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
><STYLE
>@font-face { font-family: 'cmsy7'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmsy7.ttf') }
@font-face { font-family: 'cmr7'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmr7.ttf') }
@font-face { font-family: 'cmsy10'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmsy10.ttf') }
@font-face { font-family: 'cmr10'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmr10.ttf') }
@font-face { font-family: 'cmmi7'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmmi7.ttf') }
@font-face { font-family: 'cmmi10'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmmi10.ttf') }
#G24 { position:absolute;left:0.000pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G24:before {display:inline-block;content:'';height:10.200pt }
#G25 { position:absolute;left:9.111pt;top:0;font-family:'cmmi7';font-size:8.400pt;line-height:0;}
#G25:before {display:inline-block;content:'';height:12.000pt }
#G26 { position:absolute;left:20.516pt;top:0;font-family:'cmr10';font-size:12.000pt;line-height:0;}
#G26:before {display:inline-block;content:'';height:10.200pt }
#G27 { position:absolute;left:33.183pt;top:0;font-family:'cmsy10';font-size:12.000pt;line-height:0;}
#G27:before {display:inline-block;content:'';height:10.200pt }
#G28 { position:absolute;left:39.183pt;top:0;font-family:'cmr10';font-size:12.000pt;line-height:0;}
#G28:before {display:inline-block;content:'';height:10.200pt }
#G29 { position:absolute;left:43.849pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G29:before {display:inline-block;content:'';height:10.200pt }
#G30 { position:absolute;left:52.618pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G30:before {display:inline-block;content:'';height:10.200pt }
#G31 { position:absolute;left:57.951pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G31:before {display:inline-block;content:'';height:10.200pt }
#G32 { position:absolute;left:66.527pt;top:0;font-family:'cmr7';font-size:8.400pt;line-height:0;}
#G32:before {display:inline-block;content:'';height:12.000pt }
#G33 { position:absolute;left:71.911pt;top:0;font-family:'cmr10';font-size:12.000pt;line-height:0;}
#G33:before {display:inline-block;content:'';height:10.200pt }
#G34 { position:absolute;left:76.578pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G34:before {display:inline-block;content:'';height:10.200pt }
#G35 { position:absolute;left:81.911pt;top:0;font-family:'cmr10';font-size:12.000pt;line-height:0;}
#G35:before {display:inline-block;content:'';height:10.200pt }
#G36 { position:absolute;left:86.578pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G36:before {display:inline-block;content:'';height:10.200pt }
#G37 { position:absolute;left:95.154pt;top:0;font-family:'cmr7';font-size:8.400pt;line-height:0;}
#G37:before {display:inline-block;content:'';height:12.000pt }
#G38 { position:absolute;left:100.538pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G38:before {display:inline-block;content:'';height:10.200pt }
#G39 { position:absolute;left:105.871pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G39:before {display:inline-block;content:'';height:10.200pt }
#G40 { position:absolute;left:114.447pt;top:0;font-family:'cmr7';font-size:8.400pt;line-height:0;}
#G40:before {display:inline-block;content:'';height:12.000pt }
#G41 { position:absolute;left:119.831pt;top:0;font-family:'cmr10';font-size:12.000pt;line-height:0;}
#G41:before {display:inline-block;content:'';height:10.200pt }
#G42 { position:absolute;left:124.498pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G42:before {display:inline-block;content:'';height:10.200pt }
#G43 { position:absolute;left:129.831pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G43:before {display:inline-block;content:'';height:10.200pt }
#G44 { position:absolute;left:135.164pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G44:before {display:inline-block;content:'';height:10.200pt }
#G45 { position:absolute;left:140.497pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G45:before {display:inline-block;content:'';height:10.200pt }
#G46 { position:absolute;left:145.831pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G46:before {display:inline-block;content:'';height:10.200pt }
#G47 { position:absolute;left:151.164pt;top:0;font-family:'cmr10';font-size:12.000pt;line-height:0;}
#G47:before {display:inline-block;content:'';height:10.200pt }
#G48 { position:absolute;left:155.831pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G48:before {display:inline-block;content:'';height:10.200pt }
#G49 { position:absolute;left:164.407pt;top:0;font-family:'cmmi7';font-size:8.400pt;line-height:0;}
#G49:before {display:inline-block;content:'';height:12.000pt }
#G50 { position:absolute;left:170.339pt;top:0;font-family:'cmsy7';font-size:8.400pt;line-height:0;}
#G50:before {display:inline-block;content:'';height:12.000pt }
#G51 { position:absolute;left:177.839pt;top:0;font-family:'cmr7';font-size:8.400pt;line-height:0;}
#G51:before {display:inline-block;content:'';height:12.000pt }
#G52 { position:absolute;left:183.223pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G52:before {display:inline-block;content:'';height:10.200pt }
#G53 { position:absolute;left:188.556pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G53:before {display:inline-block;content:'';height:10.200pt }
#G54 { position:absolute;left:197.133pt;top:0;font-family:'cmmi7';font-size:8.400pt;line-height:0;}
#G54:before {display:inline-block;content:'';height:12.000pt }
#G55 { position:absolute;left:203.665pt;top:0;font-family:'cmr10';font-size:12.000pt;line-height:0;}
#G55:before {display:inline-block;content:'';height:10.200pt }
#G56 { position:absolute;left:208.331pt;top:0;font-family:'cmsy10';font-size:12.000pt;line-height:0;}
#G56:before {display:inline-block;content:'';height:10.200pt }
</STYLE
><STYLE
>@font-face { font-family: 'cmmi5'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmmi5.ttf') }
@font-face { font-family: 'cmsy7'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmsy7.ttf') }
@font-face { font-family: 'cmmi7'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmmi7.ttf') }
@font-face { font-family: 'cmex10'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmex10.ttf') }
@font-face { font-family: 'cmr10'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmr10.ttf') }
@font-face { font-family: 'cmmi10'; src: url('https://novaspec.org/cl/fonts/bakoma/ttf/cmmi10.ttf') }
#G57 { position:absolute;left:0.000pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G57:before {display:inline-block;content:'';height:13.800pt }
#G58 { position:absolute;left:12.537pt;top:0;font-family:'cmr10';font-size:12.000pt;line-height:0;}
#G58:before {display:inline-block;content:'';height:13.800pt }
#G59 { position:absolute;left:30.353pt;top:0;font-family:'cmex10';font-size:12.000pt;line-height:0;}
#G59:before {display:inline-block;content:'';height:2.400pt }
#G60 { position:absolute;left:25.204pt;top:0;font-family:'cmmi7';font-size:8.400pt;line-height:0;}
#G60:before {display:inline-block;content:'';height:28.140pt }
#G61 { position:absolute;left:29.493pt;top:0;font-family:'cmsy7';font-size:8.400pt;line-height:0;}
#G61:before {display:inline-block;content:'';height:28.140pt }
#G62 { position:absolute;left:35.959pt;top:0;font-family:'cmmi7';font-size:8.400pt;line-height:0;}
#G62:before {display:inline-block;content:'';height:28.140pt }
#G63 { position:absolute;left:41.852pt;top:0;font-family:'cmmi5';font-size:6.000pt;line-height:0;}
#G63:before {display:inline-block;content:'';height:29.347pt }
#G64 { position:absolute;left:50.836pt;top:0;font-family:'cmmi10';font-size:12.000pt;line-height:0;}
#G64:before {display:inline-block;content:'';height:13.800pt }
#G65 { position:absolute;left:59.947pt;top:0;font-family:'cmmi7';font-size:8.400pt;line-height:0;}
#G65:before {display:inline-block;content:'';height:15.600pt }
</STYLE
></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="4_Types_and_Classes.html"
>4. Types and Classes</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="4_3_Classes.html"
>4.3 Classes</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="4_2_Types.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="4_4_Types_and_Classes_Dictionary.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><SECTION
><H2 ID="sec_4_3" CLASS="HeadII"
>4.3 Classes</H2
><UL CLASS="subtoc"
><LI
><A HREF="4_3_Classes.html#sec_4_3_1"
>4.3.1 Introduction to Classes</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_1_1"
>4.3.1.1 Standard Metaclasses</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_2"
>4.3.2 Defining Classes</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_3"
>4.3.3 Creating Instances of Classes</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_4"
>4.3.4 Inheritance</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_4_1"
>4.3.4.1 Examples of Inheritance</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_4_2"
>4.3.4.2 Inheritance of Class Options</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_5"
>4.3.5 Determining the Class Precedence List</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_5_1"
>4.3.5.1 Topological Sorting</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_5_2"
>4.3.5.2 Examples of Class Precedence List Determination</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_6"
>4.3.6 Redefining Classes</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_6_1"
>4.3.6.1 Modifying the Structure of Instances</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_6_2"
>4.3.6.2 Initializing Newly Added Local Slots</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_6_3"
>4.3.6.3 Customizing Class Redefinition</A
></LI
><LI
><A HREF="4_3_Classes.html#sec_4_3_7"
>4.3.7 Integrating Types and Classes</A
></LI
></UL
><P CLASS="j"
>While the object system is general enough to describe all <A HREF="26_1_Glossary.html#standardized"
><EM CLASS="term"
>standardized</EM
></A
> <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> (including, for example, <A HREF="t_number.html" CLASS="typeref"
><B
>number</B
></A
>, <A HREF="t_hash-table.html" CLASS="typeref"
><B
>hash-table</B
></A
>, and <A HREF="t_symbol.html" CLASS="typeref"
><B
>symbol</B
></A
>), Figure 4&#8211;7 contains a list of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> that are especially relevant to understanding the object system.</P
><DIV CLASS="displaythree"
><FIGURE CLASS="boxfig"
><DIV CLASS="figbody"
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
><TBODY
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
><A HREF="t_built-in-class.html" CLASS="misc"
><B
>built-in-class</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_method-combination.html" CLASS="misc"
><B
>method-combination</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_standard-object.html" CLASS="misc"
><B
>standard-object</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_class.html" CLASS="misc"
><B
>class</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_standard-class.html" CLASS="misc"
><B
>standard-class</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_structure-class.html" CLASS="misc"
><B
>structure-class</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_generic-function.html" CLASS="misc"
><B
>generic-function</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_standard-generic-function.html" CLASS="misc"
><B
>standard-generic-function</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_structure-object.html" CLASS="misc"
><B
>structure-object</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_method.html" CLASS="misc"
><B
>method</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_standard-method.html" CLASS="misc"
><B
>standard-method</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
><SPAN CLASS="misc"
></SPAN
></TD
></TR
></TBODY
></TABLE
></DIV
><FIGCAPTION CLASS="caption"
><B
>Figure 4&#8211;7. Object System Classes</B
></FIGCAPTION
></FIGURE
></DIV
><H3 ID="sec_4_3_1" CLASS="HeadIII"
>4.3.1 Introduction to Classes</H3
><P CLASS="j"
>A <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>class</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="class"
></SPAN
>is an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> that determines the structure and behavior of a set of other <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>objects</EM
></A
>, which are called its <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>instances</SPAN
></DFN
><SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="instance"
></SPAN
>. </P
><P CLASS="j"
>A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> can inherit structure and behavior from other <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
>. A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> whose definition refers to other <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> for the purpose of inheriting from them is said to be a <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclass</EM
></A
> of each of those <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
>. The <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> that are designated for purposes of inheritance are said to be <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> of the inheriting <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. </P
><P CLASS="j"
>A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> can have a <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
>. The <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> <A HREF="f_class-name.html" CLASS="funref"
><B
>class-name</B
></A
> takes 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
> and returns its <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
>. The <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> of an anonymous <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is <SPAN CLASS="misc"
><B
>nil</B
></SPAN
>. A <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> can <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. The <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> <A HREF="f_find-class.html" CLASS="funref"
><B
>find-class</B
></A
> takes a <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> and returns the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that the <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> names. A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> has a <A HREF="26_1_Glossary.html#proper_name"
><EM CLASS="term"
>proper name</EM
></A
> if the <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> is a <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> and if the <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> names that <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. That is, a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>&#160;<I
>C</I
> has the <A HREF="26_1_Glossary.html#proper_name"
><EM CLASS="term"
>proper name</EM
></A
>&#160;<I
>S</I
> if <I
>S</I
> = <CODE CLASS="f"
>(class-name <I
>C</I
>)</CODE
> and <I
>C</I
>= <CODE CLASS="f"
>(find-class <I
>S</I
>)</CODE
>. Notice that it is possible for <CODE CLASS="f"
>(find-class <I
>S</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
>)</CODE
> = <CODE CLASS="f"
>(find-class <I
>S</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
>)</CODE
> and <I
>S</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> &#8800; <I
>S</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
>. If <I
>C</I
>= <CODE CLASS="f"
>(find-class <I
>S</I
>)</CODE
>, we say that <I
>C</I
> is the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>named</EM
></A
> <I
>S</I
>. </P
><P CLASS="j"
>A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> is a <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>direct</SPAN
> <SPAN CLASS="cmbxsl"
>superclass</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="direct superclass"
></SPAN
>of a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> if <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> explicitly designates <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> as a <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> in its definition. In this case <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> is a <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>direct</SPAN
> <SPAN CLASS="cmbxsl"
>subclass</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="direct subclass"
></SPAN
>of <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
>. A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <I
>C</I
><SUB CLASS="sub"
><I
>n</I
></SUB
> is a <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>superclass</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="superclass"
></SPAN
>of a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> if there exists a series of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
><I
>,</I
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>,</I
>&#8201;<I
>C</I
><SUB CLASS="sub"
><I
>n</I
><SPAN CLASS="cmsy"
>&#8722;</SPAN
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> such that <I
>C</I
><SUB CLASS="sub"
><I
>i</I
><SPAN CLASS="cmr"
>+</SPAN
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> is a <A HREF="26_1_Glossary.html#direct_superclass"
><EM CLASS="term"
>direct superclass</EM
></A
> of <I
>C</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> for 1 &#8804; <I
>i</I
> <SPAN CLASS="cmtt"
>&lt;</SPAN
> <I
>n</I
>. In this case, <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> is a <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>subclass</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="subclass"
></SPAN
>of <I
>C</I
><SUB CLASS="sub"
><I
>n</I
></SUB
>. A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is considered neither a <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> nor a <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclass</EM
></A
> of itself. That is, if <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> is a <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> of <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
>, then <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> &#8800; <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
>. The set of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> consisting of some given <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <I
>C</I
> along with all of its <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> is called &#8220;<I
>C</I
> and its superclasses.&#8221; </P
><P CLASS="j"
>Each <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> has a <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>class</SPAN
> <SPAN CLASS="cmbxsl"
>precedence</SPAN
> <SPAN CLASS="cmbxsl"
>list</SPAN
></DFN
><SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="class precedence list"
></SPAN
>, which is a total ordering on the set of the given <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> and its <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. The total ordering is expressed as a list ordered from most specific to least specific. The <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> is used in several ways. In general, more specific <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> can <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>shadow</SPAN
></DFN
><SPAN CLASS="meaning"
><SUB CLASS="sub"
><SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="shadow"
></SPAN
><SPAN CLASS="cmr"
>1</SPAN
></SUB
></SPAN
> features that would otherwise be inherited from less specific <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
>. The <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>method</EM
></A
> selection and combination process uses the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> to order <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
> from most specific to least specific. </P
><P CLASS="j"
>When a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is defined, the order in which its direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> are mentioned in the defining form is important. Each <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> has a <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>local</SPAN
> <SPAN CLASS="cmbxsl"
>precedence</SPAN
> <SPAN CLASS="cmbxsl"
>order</SPAN
></DFN
><SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="local precedence order"
></SPAN
>, which is a <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>list</EM
></A
> consisting of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> followed by its <A HREF="26_1_Glossary.html#direct_superclass"
><EM CLASS="term"
>direct superclasses</EM
></A
> in the order mentioned in the defining <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
>. </P
><P CLASS="j"
>A <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> is always consistent with the <A HREF="26_1_Glossary.html#local_precedence_order"
><EM CLASS="term"
>local precedence order</EM
></A
> of each <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> in the list. The <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> in each <A HREF="26_1_Glossary.html#local_precedence_order"
><EM CLASS="term"
>local precedence order</EM
></A
> appear within the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> in the same order. If the <A HREF="26_1_Glossary.html#local_precedence_order"
><EM CLASS="term"
>local precedence orders</EM
></A
> are inconsistent with each other, no <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> can be constructed, and an error is signaled. The <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> and its computation is discussed in <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
>. </P
><P CLASS="j"
><A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> are organized into a directed acyclic graph. There are two distinguished <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
>, named <A HREF="t_t.html" CLASS="typeref"
><B
>t</B
></A
> and <A HREF="t_standard-object.html" CLASS="typeref"
><B
>standard-object</B
></A
>. The <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> named <A HREF="t_t.html" CLASS="typeref"
><B
>t</B
></A
> has no <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. It is a <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> of every <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> except itself. The <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> named <A HREF="t_standard-object.html" CLASS="typeref"
><B
>standard-object</B
></A
> is 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
> <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
> and is a <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> of every <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that is 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
> <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
> except itself. </P
><P CLASS="j"
>There is a mapping from the object system <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> space into the <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> space. Many of the standard <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>types</EM
></A
> specified in this document have a corresponding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that has the same <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> as the <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
>. Some <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>types</EM
></A
> do not have a corresponding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. The integration of the <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> and <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> systems is discussed in <A HREF="4_3_Classes.html#sec_4_3_7" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>4.3.7</SPAN
> <SPAN CLASS="cmr"
>(Integrating</SPAN
> <SPAN CLASS="cmr"
>Types</SPAN
> <SPAN CLASS="cmr"
>and</SPAN
> <SPAN CLASS="cmr"
>Classes)</SPAN
></A
>. </P
><P CLASS="j"
><A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>Classes</EM
></A
> are represented by <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>objects</EM
></A
> that are themselves <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
>. The <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> of an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> is termed the <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>metaclass</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="metaclass"
></SPAN
>of that <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>. When no misinterpretation is possible, the term <A HREF="26_1_Glossary.html#metaclass"
><EM CLASS="term"
>metaclass</EM
></A
> is used to refer to a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that has <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> that are themselves <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
>. The <A HREF="26_1_Glossary.html#metaclass"
><EM CLASS="term"
>metaclass</EM
></A
> determines the form of inheritance used by the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> that are its <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> and the representation of the <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> of those <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
>. The object system provides a default <A HREF="26_1_Glossary.html#metaclass"
><EM CLASS="term"
>metaclass</EM
></A
>, <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
>, that is appropriate for most programs. </P
><P CLASS="j"
>Except where otherwise specified, all <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> mentioned in this standard are <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
> <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
>, all <A HREF="26_1_Glossary.html#generic_function"
><EM CLASS="term"
>generic functions</EM
></A
> are <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
> <A HREF="t_standard-generic-function.html" CLASS="typeref"
><B
>standard-generic-function</B
></A
>, and all <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
> are <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
> <A HREF="t_standard-method.html" CLASS="typeref"
><B
>standard-method</B
></A
>.</P
><H4 ID="sec_4_3_1_1" CLASS="HeadIV"
>4.3.1.1 Standard Metaclasses</H4
><P CLASS="j"
>The object system provides a number of predefined <A HREF="26_1_Glossary.html#metaclass"
><EM CLASS="term"
>metaclasses</EM
></A
>. These include the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
>, <A HREF="t_built-in-class.html" CLASS="typeref"
><B
>built-in-class</B
></A
>, and <A HREF="t_structure-class.html" CLASS="typeref"
><B
>structure-class</B
></A
>:</P
><UL
><LI
><P CLASS="j"
>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
> is the default <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> defined by <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
>.</P
></LI
><LI
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="t_built-in-class.html" CLASS="typeref"
><B
>built-in-class</B
></A
> is the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> whose <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> are <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> that have special implementations with restricted capabilities. Any <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that corresponds to a standard <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> might be an <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> of <A HREF="t_built-in-class.html" CLASS="typeref"
><B
>built-in-class</B
></A
>. The predefined <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> specifiers that are required to have corresponding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> are listed in Figure&#160;4&#8211;8. It is <A HREF="26_1_Glossary.html#implementation-dependent"
><EM CLASS="term"
>implementation-dependent</EM
></A
> whether each of these <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> is implemented as a <A HREF="26_1_Glossary.html#built-in_class"
><EM CLASS="term"
>built-in class</EM
></A
>.</P
></LI
><LI
><P CLASS="j"
>All <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> defined by means of <A HREF="f_defstruct.html" CLASS="macref"
><B
>defstruct</B
></A
> are <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
> <A HREF="t_structure-class.html" CLASS="typeref"
><B
>structure-class</B
></A
>.</P
></LI
></UL
><H3 ID="sec_4_3_2" CLASS="HeadIII"
>4.3.2 Defining Classes</H3
><P CLASS="j"
>The macro <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> is used to define a new named <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. </P
><P CLASS="j"
>The definition of a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> includes:</P
><UL
><LI
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> of the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. For newly-defined <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> this <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> is a <A HREF="26_1_Glossary.html#proper_name"
><EM CLASS="term"
>proper name</EM
></A
>.</P
></LI
><LI
><P CLASS="j"
>The list of the direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> of the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>.</P
></LI
><LI
><P CLASS="j"
>A set of <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>slot</SPAN
> <SPAN CLASS="cmbxsl"
>specifiers</SPAN
></DFN
><SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="slot specifier"
></SPAN
>. Each <A HREF="26_1_Glossary.html#slot_specifier"
><EM CLASS="term"
>slot specifier</EM
></A
> includes the <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> of the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> and zero or more <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> options. A <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> option pertains only to a single <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>. If a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> definition contains two <A HREF="26_1_Glossary.html#slot_specifier"
><EM CLASS="term"
>slot specifiers</EM
></A
> with the same <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
>, an error is signaled.</P
></LI
><LI
><P CLASS="j"
>A set of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> options. Each <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> option pertains to the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> as a whole.</P
></LI
></UL
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> options and <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> options of the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form provide mechanisms for the following:</P
><UL
><LI
><P CLASS="j"
>Supplying a default initial value <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
> for a given <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>.</P
></LI
><LI
><P CLASS="j"
>Requesting that <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
> for <A HREF="26_1_Glossary.html#generic_function"
><EM CLASS="term"
>generic functions</EM
></A
> be automatically generated for reading or writing <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
>.</P
></LI
><LI
><P CLASS="j"
>Controlling whether a given <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
> or whether each <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
> has its own <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>.</P
></LI
><LI
><P CLASS="j"
>Supplying a set of initialization arguments and initialization argument defaults to be used in <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> creation.</P
></LI
><LI
><P CLASS="j"
>Indicating that the <A HREF="26_1_Glossary.html#metaclass"
><EM CLASS="term"
>metaclass</EM
></A
> is to be other than the default. The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:metaclass</SPAN
></SPAN
> option is reserved for future use; an implementation can be extended to make use of the <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:metaclass</SPAN
></SPAN
> option.</P
></LI
><LI
><P CLASS="j"
>Indicating the expected <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> for the value stored in the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
>.</P
></LI
><LI
><P CLASS="j"
>Indicating the <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
>.</P
></LI
></UL
><H3 ID="sec_4_3_3" CLASS="HeadIII"
>4.3.3 Creating Instances of Classes</H3
><P CLASS="j"
>The generic function <A HREF="f_make-instance.html" CLASS="funref"
><B
>make-instance</B
></A
> creates and returns a new <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> of a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. The object system provides several mechanisms for specifying how a new <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> is to be initialized. For example, it is possible to specify the initial values for <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> in newly created <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> either by giving arguments to <A HREF="f_make-instance.html" CLASS="funref"
><B
>make-instance</B
></A
> or by providing default initial values. Further initialization activities can be performed by <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
> written for <A HREF="26_1_Glossary.html#generic_function"
><EM CLASS="term"
>generic functions</EM
></A
> that are part of the initialization protocol. The complete initialization protocol is described in <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
><H3 ID="sec_4_3_4" CLASS="HeadIII"
>4.3.4 Inheritance</H3
><P CLASS="j"
>A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> can inherit <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
>, <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
>, and some <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> options from its <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. Other sections describe the inheritance of <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
>, the inheritance of <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> and <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> options, and the inheritance of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> options.</P
><H4 ID="sec_4_3_4_1" CLASS="HeadIV"
>4.3.4.1 Examples of Inheritance</H4
><PRE CLASS="screen"
>(defclass C1 ()
((S1 :initform 5.4 :type number)
(S2 :allocation :class)))
(defclass C2 (C1)
((S1 :initform 5 :type integer)
(S2 :allocation :instance)
(S3 :accessor C2-S3)))</PRE
><P CLASS="j"
><A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>Instances</EM
></A
> of the class <CODE CLASS="f"
>C1</CODE
> have a <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slot</EM
></A
> named <CODE CLASS="f"
>S1</CODE
>, whose default initial value is 5.4 and whose <A HREF="26_1_Glossary.html#value"
><EM CLASS="term"
>value</EM
></A
> should always be a <A HREF="26_1_Glossary.html#number"
><EM CLASS="term"
>number</EM
></A
>. The class <CODE CLASS="f"
>C1</CODE
> also has a <A HREF="26_1_Glossary.html#shared_slot"
><EM CLASS="term"
>shared slot</EM
></A
> named <CODE CLASS="f"
>S2</CODE
>. </P
><P CLASS="j"
>There is a <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slot</EM
></A
> named <CODE CLASS="f"
>S1</CODE
> in <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> of <CODE CLASS="f"
>C2</CODE
>. The default initial value of <CODE CLASS="f"
>S1</CODE
> is 5. The value of <CODE CLASS="f"
>S1</CODE
> should always be of type <CODE CLASS="f"
>(and integer number)</CODE
>. There are also <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> named <CODE CLASS="f"
>S2</CODE
> and <CODE CLASS="f"
>S3</CODE
> in <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> of <CODE CLASS="f"
>C2</CODE
>. The class <CODE CLASS="f"
>C2</CODE
> has a <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>method</EM
></A
> for <CODE CLASS="f"
>C2-S3</CODE
> for reading the value of slot <CODE CLASS="f"
>S3</CODE
>; there is also a <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>method</EM
></A
> for <CODE CLASS="f"
>(setf C2-S3)</CODE
> that writes the value of <CODE CLASS="f"
>S3</CODE
>.</P
><H4 ID="sec_4_3_4_2" CLASS="HeadIV"
>4.3.4.2 Inheritance of Class Options</H4
><P CLASS="j"
>The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:default-initargs</SPAN
></SPAN
> class option is inherited. The set of defaulted initialization arguments for a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is the union of the sets of initialization arguments supplied in the <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:default-initargs</SPAN
></SPAN
> class options of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> and its <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. When more than one default initial value <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
> is supplied for a given initialization argument, the default initial value <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
> that is used is the one supplied by the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that is most specific according to the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
>. </P
><P CLASS="j"
>If a given <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:default-initargs</SPAN
></SPAN
> class option specifies an initialization argument of the same <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> more than once, 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
><H3 ID="sec_4_3_5" CLASS="HeadIII"
>4.3.5 Determining the Class Precedence List</H3
><P CLASS="j"
>The <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form for a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> provides a total ordering on that <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> and its direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. This ordering is called the <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>local</SPAN
> <SPAN CLASS="cmbxsl"
>precedence</SPAN
> <SPAN CLASS="cmbxsl"
>order</SPAN
></DFN
><SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="local precedence order"
></SPAN
>. It is an ordered list of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> and its direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. The <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>class</SPAN
> <SPAN CLASS="cmbxsl"
>precedence</SPAN
> <SPAN CLASS="cmbxsl"
>list</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="class precedence list"
></SPAN
>for a class <I
>C</I
> is a total ordering on <I
>C</I
> and its <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> that is consistent with the <A HREF="26_1_Glossary.html#local_precedence_order"
><EM CLASS="term"
>local precedence orders</EM
></A
> for each of <I
>C</I
> and its <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. </P
><P CLASS="j"
>A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> precedes its direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>, and a direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> precedes all other direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> specified to its right in the <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> list of the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form. For every class <I
>C</I
>, define</P
><CENTER CLASS="displaymath"
><SPAN STYLE="display:inline-block;position:relative;width:214.331pt;height:14.400pt;vertical-align:0.000pt;xborder:1px solid #ccc"
><SPAN ID="G24"
>R</SPAN
><SPAN ID="G25"
>C</SPAN
><SPAN ID="G26"
>=</SPAN
><SPAN ID="G27"
>f</SPAN
><SPAN ID="G28"
>(</SPAN
><SPAN ID="G29"
>C</SPAN
><SPAN ID="G30"
>;</SPAN
><SPAN ID="G31"
>C</SPAN
><SPAN ID="G32"
>1</SPAN
><SPAN ID="G33"
>)</SPAN
><SPAN ID="G34"
>;</SPAN
><SPAN ID="G35"
>(</SPAN
><SPAN ID="G36"
>C</SPAN
><SPAN ID="G37"
>1</SPAN
><SPAN ID="G38"
>;</SPAN
><SPAN ID="G39"
>C</SPAN
><SPAN ID="G40"
>2</SPAN
><SPAN ID="G41"
>)</SPAN
><SPAN ID="G42"
>;</SPAN
><SPAN ID="G43"
>:</SPAN
><SPAN ID="G44"
>:</SPAN
><SPAN ID="G45"
>:</SPAN
><SPAN ID="G46"
>;</SPAN
><SPAN ID="G47"
>(</SPAN
><SPAN ID="G48"
>C</SPAN
><SPAN ID="G49"
>n</SPAN
><SPAN ID="G50"
>&#161;</SPAN
><SPAN ID="G51"
>1</SPAN
><SPAN ID="G52"
>;</SPAN
><SPAN ID="G53"
>C</SPAN
><SPAN ID="G54"
>n</SPAN
><SPAN ID="G55"
>)</SPAN
><SPAN ID="G56"
>g</SPAN
></SPAN
></CENTER
><P CLASS="j"
>where <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
><I
>,</I
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>,</I
>&#8201;<I
>C</I
><SUB CLASS="sub"
><I
>n</I
></SUB
> are the direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> of <I
>C</I
> in the order in which they are mentioned in the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form. These ordered pairs generate the total ordering on the class <I
>C</I
> and its direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. </P
><P CLASS="j"
>Let <I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
> be the set of <I
>C</I
> and its <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. Let <I
>R</I
> be</P
><CENTER CLASS="displaymath"
><SPAN STYLE="display:inline-block;position:relative;width:64.236pt;height:30.547pt;vertical-align:0.000pt;xborder:1px solid #ccc"
><SPAN ID="G57"
>R</SPAN
><SPAN ID="G58"
>=</SPAN
><SPAN ID="G59"
>[</SPAN
><SPAN ID="G60"
>c</SPAN
><SPAN ID="G61"
>2</SPAN
><SPAN ID="G62"
>S</SPAN
><SPAN ID="G63"
>C</SPAN
><SPAN ID="G64"
>R</SPAN
><SPAN ID="G65"
>c</SPAN
></SPAN
></CENTER
><P CLASS="j"
>. </P
><P CLASS="j"
>The set <I
>R</I
> might or might not generate a partial ordering, depending on whether the <I
>R</I
><SUB CLASS="sub"
><I
>c</I
></SUB
>, <I
>c</I
> &#8712; <I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
>, are consistent; it is assumed that they are consistent and that <I
>R</I
> generates a partial ordering. When the <I
>R</I
><SUB CLASS="sub"
><I
>c</I
></SUB
> are not consistent, it is said that <I
>R</I
> is inconsistent. </P
><P CLASS="j"
>To compute the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> for&#160;<I
>C</I
>, topologically sort the elements of <I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
> with respect to the partial ordering generated by <I
>R</I
>. When the topological sort must select a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> from a set of two or more <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
>, none of which are preceded by other <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> with respect to&#160;<I
>R</I
>, the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> selected is chosen deterministically, as described below. </P
><P CLASS="j"
>If <I
>R</I
> is inconsistent, an error is signaled.</P
><H4 ID="sec_4_3_5_1" CLASS="HeadIV"
>4.3.5.1 Topological Sorting</H4
><P CLASS="j"
>Topological sorting proceeds by finding a class <I
>C</I
> in&#160;<I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
> such that no other <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> precedes that element according to the elements in&#160;<I
>R</I
>. The class <I
>C</I
> is placed first in the result. Remove <I
>C</I
> from <I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
>, and remove all pairs of the form (<I
>C,</I
>&#8201;<I
>D</I
>), <I
>D</I
> &#8712; <I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
>, from <I
>R</I
>. Repeat the process, adding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> with no predecessors to the end of the result. Stop when no element can be found that has no predecessor. </P
><P CLASS="j"
>If <I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
> is not empty and the process has stopped, the set <I
>R</I
> is inconsistent. If every <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> in the finite set of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> is preceded by another, then <I
>R</I
> contains a loop. That is, there is a chain of classes <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
><I
>,</I
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>,</I
>&#8201;<I
>C</I
><SUB CLASS="sub"
><I
>n</I
></SUB
> such that <I
>C</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> precedes <I
>C</I
><SUB CLASS="sub"
><I
>i</I
><SPAN CLASS="cmr"
>+</SPAN
><SPAN CLASS="cmr"
>1</SPAN
></SUB
>, 1&#8804;<I
>i</I
><SPAN CLASS="cmtt"
>&lt;</SPAN
><I
>n</I
>, and <I
>C</I
><SUB CLASS="sub"
><I
>n</I
></SUB
> precedes <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
>. </P
><P CLASS="j"
>Sometimes there are several <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> from <I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
> with no predecessors. In this case select the one that has a direct <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclass</EM
></A
> rightmost in the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> computed so far. (If there is no such candidate <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>, <I
>R</I
> does not generate a partial ordering &#8212; the <I
>R</I
><SUB CLASS="sub"
><I
>c</I
></SUB
>, <I
>c</I
> &#8712; <I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
>, are inconsistent.) </P
><P CLASS="j"
>In more precise terms, let {<I
>N</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
><I
>,</I
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>,</I
>&#8201;<I
>N</I
><SUB CLASS="sub"
><I
>m</I
></SUB
>}, <I
>m</I
> &#8805; 2, be the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> from <I
>S</I
><SUB CLASS="sub"
><I
>C</I
></SUB
> with no predecessors. Let (<I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>.</I
>&#8201;<I
>C</I
><SUB CLASS="sub"
><I
>n</I
></SUB
>), <I
>n</I
> &#8805; 1, be the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> constructed so far. <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> is the most specific <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>, and <I
>C</I
><SUB CLASS="sub"
><I
>n</I
></SUB
> is the least specific. Let 1 &#8804; <I
>j</I
> &#8804; <I
>n</I
> be the largest number such that there exists an <I
>i</I
> where 1&#8804;<I
>i</I
>&#8804;<I
>m</I
> and <I
>N</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> is a direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> of <I
>C</I
><SUB CLASS="sub"
><I
>j</I
></SUB
>; <I
>N</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> is placed next. </P
><P CLASS="j"
>The effect of this rule for selecting from a set of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> with no predecessors is that the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> in a simple <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclass</EM
></A
> chain are adjacent in the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> and that <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> in each relatively separated subgraph are adjacent in the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
>. For example, let <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> and <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> be subgraphs whose only element in common is the class <I
>J</I
>. Suppose that no superclass of <I
>J</I
> appears in either <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> or <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
>, and that <I
>J</I
> is in the superclass chain of every class in both <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> and <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
>. Let <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> be the bottom of <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
>; and let <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> be the bottom of <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
>. Suppose <I
>C</I
> is a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> whose direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> are <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> and <I
>C</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> in that order, then the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> for <I
>C</I
> starts with <I
>C</I
> and is followed by all <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> in <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>1</SPAN
></SUB
> except <I
>J</I
>. All the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> of <I
>T</I
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
> are next. The <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <I
>J</I
> and its <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> appear last.</P
><H4 ID="sec_4_3_5_2" CLASS="HeadIV"
>4.3.5.2 Examples of Class Precedence List Determination</H4
><P CLASS="j"
>This example determines a <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> for the class <CODE CLASS="f"
>pie</CODE
>. The following <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> are defined:</P
><PRE CLASS="screen"
>(defclass pie (apple cinnamon) ())
(defclass apple (fruit) ())
(defclass cinnamon (spice) ())
(defclass fruit (food) ())
(defclass spice (food) ())
(defclass food () ())</PRE
><DIV
>The set <I
>S</I
><SUB CLASS="sub"
><I
>pie</I
></SUB
>&#160;= {<SPAN CLASS="cmtt"
>pie,</SPAN
> <SPAN CLASS="cmtt"
>apple,</SPAN
> <SPAN CLASS="cmtt"
>cinnamon,</SPAN
> <SPAN CLASS="cmtt"
>fruit,</SPAN
> <SPAN CLASS="cmtt"
>spice,</SPAN
> <SPAN CLASS="cmtt"
>food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t</SPAN
>}. The set <I
>R</I
>&#160;= {<SPAN CLASS="cmtt"
>(pie,</SPAN
> <SPAN CLASS="cmtt"
>apple),</SPAN
> <SPAN CLASS="cmtt"
>(apple,</SPAN
> <SPAN CLASS="cmtt"
>cinnamon),</SPAN
> <SPAN CLASS="cmtt"
>(apple,</SPAN
> <SPAN CLASS="cmtt"
>fruit),</SPAN
> <SPAN CLASS="cmtt"
>(cinnamon,</SPAN
> <SPAN CLASS="cmtt"
>spice),</SPAN
> </DIV
><DIV
><SPAN CLASS="cmtt"
>(fruit,</SPAN
> <SPAN CLASS="cmtt"
>food),</SPAN
> <SPAN CLASS="cmtt"
>(spice,</SPAN
> <SPAN CLASS="cmtt"
>food),</SPAN
> <SPAN CLASS="cmtt"
>(food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object),</SPAN
> <SPAN CLASS="cmtt"
>(standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t)</SPAN
>}. </DIV
><DIV
>The class <CODE CLASS="f"
>pie</CODE
> is not preceded by anything, so it comes first; the result so far is <SPAN CLASS="cmtt"
>(pie)</SPAN
>. Remove <CODE CLASS="f"
>pie</CODE
> from <I
>S</I
> and pairs mentioning <CODE CLASS="f"
>pie</CODE
> from <I
>R</I
> to get <I
>S</I
>&#160;= {<SPAN CLASS="cmtt"
>apple,</SPAN
> <SPAN CLASS="cmtt"
>cinnamon,</SPAN
> <SPAN CLASS="cmtt"
>fruit,</SPAN
> <SPAN CLASS="cmtt"
>spice,</SPAN
> <SPAN CLASS="cmtt"
>food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t</SPAN
>} and <I
>R</I
>&#160;=&#160;{<SPAN CLASS="cmtt"
>(apple,</SPAN
> <SPAN CLASS="cmtt"
>cinnamon),</SPAN
> <SPAN CLASS="cmtt"
>(apple,</SPAN
> <SPAN CLASS="cmtt"
>fruit),</SPAN
> <SPAN CLASS="cmtt"
>(cinnamon,</SPAN
> <SPAN CLASS="cmtt"
>spice),</SPAN
> </DIV
><DIV
><SPAN CLASS="cmtt"
>(fruit,</SPAN
> <SPAN CLASS="cmtt"
>food),</SPAN
> <SPAN CLASS="cmtt"
>(spice,</SPAN
> <SPAN CLASS="cmtt"
>food),</SPAN
> <SPAN CLASS="cmtt"
>(food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object),</SPAN
> <SPAN CLASS="cmtt"
>(standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t)</SPAN
>}. </DIV
><DIV
>The class <CODE CLASS="f"
>apple</CODE
> is not preceded by anything, so it is next; the result is <SPAN CLASS="cmtt"
>(pie</SPAN
> <SPAN CLASS="cmtt"
>apple)</SPAN
>. Removing <CODE CLASS="f"
>apple</CODE
> and the relevant pairs results in <I
>S</I
>&#160;= {<SPAN CLASS="cmtt"
>cinnamon,</SPAN
> <SPAN CLASS="cmtt"
>fruit,</SPAN
> <SPAN CLASS="cmtt"
>spice,</SPAN
> <SPAN CLASS="cmtt"
>food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t</SPAN
>} and <I
>R</I
>&#160;= {<SPAN CLASS="cmtt"
>(cinnamon,</SPAN
> <SPAN CLASS="cmtt"
>spice),</SPAN
> <SPAN CLASS="cmtt"
>(fruit,</SPAN
> <SPAN CLASS="cmtt"
>food),</SPAN
> <SPAN CLASS="cmtt"
>(spice,</SPAN
> <SPAN CLASS="cmtt"
>food),</SPAN
> <SPAN CLASS="cmtt"
>(food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object),</SPAN
> </DIV
><DIV
><SPAN CLASS="cmtt"
>(standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t)</SPAN
>}. </DIV
><DIV
>The classes <CODE CLASS="f"
>cinnamon</CODE
> and <SPAN CLASS="cmtt"
>fruit</SPAN
> are not preceded by anything, so the one with a direct <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclass</EM
></A
> rightmost in the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> computed so far goes next. The class <CODE CLASS="f"
>apple</CODE
> is a direct <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclass</EM
></A
> of <SPAN CLASS="cmtt"
>fruit</SPAN
>, and the class <CODE CLASS="f"
>pie</CODE
> is a direct <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclass</EM
></A
> of <CODE CLASS="f"
>cinnamon</CODE
>. Because <CODE CLASS="f"
>apple</CODE
> appears to the right of <CODE CLASS="f"
>pie</CODE
> in the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
>, <SPAN CLASS="cmtt"
>fruit</SPAN
> goes next, and the result so far is <SPAN CLASS="cmtt"
>(pie</SPAN
> <SPAN CLASS="cmtt"
>apple</SPAN
> <SPAN CLASS="cmtt"
>fruit)</SPAN
>. <I
>S</I
>&#160;= {<SPAN CLASS="cmtt"
>cinnamon,</SPAN
> <SPAN CLASS="cmtt"
>spice,</SPAN
> <SPAN CLASS="cmtt"
>food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t</SPAN
>}; <I
>R</I
>&#160;= {<SPAN CLASS="cmtt"
>(cinnamon,</SPAN
> <SPAN CLASS="cmtt"
>spice),</SPAN
> <SPAN CLASS="cmtt"
>(spice,</SPAN
> <SPAN CLASS="cmtt"
>food),</SPAN
> </DIV
><DIV
><SPAN CLASS="cmtt"
>(food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object),</SPAN
> <SPAN CLASS="cmtt"
>(standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t)</SPAN
>}. </DIV
><P CLASS="j"
>The class <CODE CLASS="f"
>cinnamon</CODE
> is next, giving the result so far as <SPAN CLASS="cmtt"
>(pie</SPAN
> <SPAN CLASS="cmtt"
>apple</SPAN
> <SPAN CLASS="cmtt"
>fruit</SPAN
> <SPAN CLASS="cmtt"
>cinnamon)</SPAN
>. At this point <I
>S</I
>&#160;= {<SPAN CLASS="cmtt"
>spice,</SPAN
> <SPAN CLASS="cmtt"
>food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t</SPAN
>}; <I
>R</I
>&#160;= {<SPAN CLASS="cmtt"
>(spice,</SPAN
> <SPAN CLASS="cmtt"
>food),</SPAN
> <SPAN CLASS="cmtt"
>(food,</SPAN
> <SPAN CLASS="cmtt"
>standard-object),</SPAN
> <SPAN CLASS="cmtt"
>(standard-object,</SPAN
> <SPAN CLASS="cmtt"
>t)</SPAN
>}. </P
><P CLASS="j"
>The classes <CODE CLASS="f"
>spice</CODE
>, <CODE CLASS="f"
>food</CODE
>, <A HREF="t_standard-object.html" CLASS="typeref"
><B
>standard-object</B
></A
>, and <A HREF="t_t.html" CLASS="typeref"
><B
>t</B
></A
> are added in that order, and the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> is <CODE CLASS="f"
>(pie apple fruit cinnamon spice food standard-object t)</CODE
>. </P
><P CLASS="j"
>It is possible to write a set of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> definitions that cannot be ordered. For example:</P
><PRE CLASS="screen"
>(defclass new-class (fruit apple) ())
(defclass apple (fruit) ())</PRE
><P CLASS="j"
>The class <CODE CLASS="f"
>fruit</CODE
> must precede <CODE CLASS="f"
>apple</CODE
> because the local ordering of <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> must be preserved. The class <CODE CLASS="f"
>apple</CODE
> must precede <CODE CLASS="f"
>fruit</CODE
> because a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> always precedes its own <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>. When this situation occurs, an error is signaled, as happens here when the system tries to compute the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> of <CODE CLASS="f"
>new-class</CODE
>. </P
><P CLASS="j"
>The following might appear to be a conflicting set of definitions:</P
><PRE CLASS="screen"
>(defclass pie (apple cinnamon) ())
(defclass pastry (cinnamon apple) ())
(defclass apple () ())
(defclass cinnamon () ())</PRE
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> for <CODE CLASS="f"
>pie</CODE
> is <CODE CLASS="f"
>(pie apple cinnamon standard-object t)</CODE
>. </P
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> for <CODE CLASS="f"
>pastry</CODE
> is <CODE CLASS="f"
>(pastry cinnamon apple standard-object t)</CODE
>. </P
><P CLASS="j"
>It is not a problem for <CODE CLASS="f"
>apple</CODE
> to precede <CODE CLASS="f"
>cinnamon</CODE
> in the ordering of the <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> of <CODE CLASS="f"
>pie</CODE
> but not in the ordering for <CODE CLASS="f"
>pastry</CODE
>. However, it is not possible to build a new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that has both <CODE CLASS="f"
>pie</CODE
> and <CODE CLASS="f"
>pastry</CODE
> as <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
>.</P
><H3 ID="sec_4_3_6" CLASS="HeadIII"
>4.3.6 Redefining Classes</H3
><P CLASS="j"
>A <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that is a <A HREF="26_1_Glossary.html#direct_instance"
><EM CLASS="term"
>direct instance</EM
></A
> of <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
> can be redefined if the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is also a <A HREF="26_1_Glossary.html#direct_instance"
><EM CLASS="term"
>direct instance</EM
></A
> of <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
>. Redefining a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> modifies the existing <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
> to reflect the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> definition; it does not create a 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
> for the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. Any <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>method</EM
></A
> <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> created by a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:reader</SPAN
></SPAN
>, <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:writer</SPAN
></SPAN
>, or <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:accessor</SPAN
></SPAN
> option specified by the old <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form is removed from the corresponding <A HREF="26_1_Glossary.html#generic_function"
><EM CLASS="term"
>generic function</EM
></A
>. <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>Methods</EM
></A
> specified by the new <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> form are added. </P
><P CLASS="j"
>When the class <I
>C</I
> is redefined, changes are propagated to its <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> and to <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> of any of its <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclasses</EM
></A
>. Updating such an <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> occurs at an <A HREF="26_1_Glossary.html#implementation-dependent"
><EM CLASS="term"
>implementation-dependent</EM
></A
> time, but no later than the next time a <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> of that <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> is read or written. Updating an <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> does not change its identity as defined by the <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> <A HREF="f_eq.html" CLASS="funref"
><B
>eq</B
></A
>. The updating process may change the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> of that particular <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
>, but it does not create a new <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
>. Whether updating an <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> consumes storage is <A HREF="26_1_Glossary.html#implementation-dependent"
><EM CLASS="term"
>implementation-dependent</EM
></A
>. </P
><P CLASS="j"
>Note that redefining a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> may cause <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> to be added or deleted. If a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is redefined in a way that changes the set of <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> in <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
>, the <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> are updated. It is <A HREF="26_1_Glossary.html#implementation-dependent"
><EM CLASS="term"
>implementation-dependent</EM
></A
> whether <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> are updated if a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is redefined in a way that does not change the set of <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> in <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
>. </P
><P CLASS="j"
>The value of a <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> that is specified as shared both in the old <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> and in the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is retained. If such a <A HREF="26_1_Glossary.html#shared_slot"
><EM CLASS="term"
>shared slot</EM
></A
> was unbound in the old <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>, it is unbound in the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>Slots</EM
></A
> that were local in the old <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> and that are shared in the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> are initialized. Newly added <A HREF="26_1_Glossary.html#shared_slot"
><EM CLASS="term"
>shared slots</EM
></A
> are initialized. </P
><P CLASS="j"
>Each newly added <A HREF="26_1_Glossary.html#shared_slot"
><EM CLASS="term"
>shared slot</EM
></A
> is set to the result of evaluating the <A HREF="26_1_Glossary.html#captured_initialization_form"
><EM CLASS="term"
>captured initialization form</EM
></A
> for the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> that was specified in the <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> <A HREF="26_1_Glossary.html#form"
><EM CLASS="term"
>form</EM
></A
> for the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. If there was no <A HREF="26_1_Glossary.html#initialization_form"
><EM CLASS="term"
>initialization form</EM
></A
>, the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> is unbound. </P
><P CLASS="j"
>If a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is redefined in such a way that the set of <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> in 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
> is changed, a two-step process of updating the <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
> takes place. The process may be explicitly started by invoking the generic function <A HREF="f_make-instances-obsolete.html" CLASS="funref"
><B
>make-instances-obsolete</B
></A
>. This two-step process can happen in other circumstances in some implementations. For example, in some implementations this two-step process is triggered if the order of <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> in storage is changed. </P
><P CLASS="j"
>The first step modifies the structure of the <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> by adding new <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> and discarding <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> that are not defined in the new version of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. The second step initializes the newly-added <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> and performs any other user-defined actions. These two steps are further specified in the next two sections.</P
><H4 ID="sec_4_3_6_1" CLASS="HeadIV"
>4.3.6.1 Modifying the Structure of Instances</H4
><P CLASS="j"
>The first step modifies the structure of <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> of the redefined <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> to conform to its new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> definition. <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>Local slots</EM
></A
> specified by the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> definition that are not specified as either local or shared by the old <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> are added, and <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> not specified as either local or shared by the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> definition that are specified as local by the old <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> are discarded. The <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>names</EM
></A
> of these added and discarded <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> are passed as arguments to <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
> as described in the next section. </P
><P CLASS="j"
>The values of <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> specified by both the new and old <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> are retained. If such a <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slot</EM
></A
> was unbound, it remains unbound. </P
><P CLASS="j"
>The value of a <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> that is specified as shared in the old <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> and as local in the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is retained. If such a <A HREF="26_1_Glossary.html#shared_slot"
><EM CLASS="term"
>shared slot</EM
></A
> was unbound, the <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slot</EM
></A
> is unbound.</P
><H4 ID="sec_4_3_6_2" CLASS="HeadIV"
>4.3.6.2 Initializing Newly Added Local Slots</H4
><P CLASS="j"
>The second step initializes the newly added <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> and performs any other user-defined actions. This step is implemented by the generic function <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
>, which is called after completion of the first step of modifying the structure of the <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
>. </P
><P CLASS="j"
>The generic function <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
> takes four required arguments: the <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> being updated after it has undergone the first step, a list of the names of <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> that were added, a list of the names of <A HREF="26_1_Glossary.html#local_slot"
><EM CLASS="term"
>local slots</EM
></A
> that were discarded, and a property list containing the <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slot</EM
></A
> names and values of <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> that were discarded and had values. Included among the discarded <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> are <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> that were local in the old <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> and that are shared in the new <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. </P
><P CLASS="j"
>The generic function <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
> also takes any number of initialization arguments. When it is called by the system to update an <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> whose <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> has been redefined, no initialization arguments are provided. </P
><P CLASS="j"
>There is a system-supplied primary <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>method</EM
></A
> for <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
> whose <A HREF="26_1_Glossary.html#parameter_specializer"
><EM CLASS="term"
>parameter specializer</EM
></A
> for its <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> argument is the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="t_standard-object.html" CLASS="typeref"
><B
>standard-object</B
></A
>. First this <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>method</EM
></A
> checks the validity of initialization arguments and signals an error if an initialization argument is supplied that is not declared as valid. (For more information, see <A HREF="7_1_Object_Creation_and_Initialization.html#sec_7_1_2" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>7.1.2</SPAN
> <SPAN CLASS="cmr"
>(Declaring</SPAN
> <SPAN CLASS="cmr"
>the</SPAN
> <SPAN CLASS="cmr"
>Validity</SPAN
> <SPAN CLASS="cmr"
>of</SPAN
> <SPAN CLASS="cmr"
>Initialization</SPAN
> <SPAN CLASS="cmr"
>Arguments)</SPAN
></A
>.) Then it calls the generic function <A HREF="f_shared-initialize.html" CLASS="funref"
><B
>shared-initialize</B
></A
> with the following arguments: the <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
>, the list of <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>names</EM
></A
> of the newly added <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
>, and the initialization arguments it received.</P
><H4 ID="sec_4_3_6_3" CLASS="HeadIV"
>4.3.6.3 Customizing Class Redefinition</H4
><P CLASS="j"
><A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>Methods</EM
></A
> for <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
> may be defined to specify actions to be taken when an <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> is updated. If only <A HREF="26_1_Glossary.html#after_method"
><EM CLASS="term"
>after methods</EM
></A
> for <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
> are defined, they will be run after the system-supplied primary <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>method</EM
></A
> for initialization and therefore will not interfere with the default behavior of <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
>. Because no initialization arguments are passed to <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
> when it is called by the system, the <A HREF="26_1_Glossary.html#initialization_form"
><EM CLASS="term"
>initialization forms</EM
></A
> for <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> that are filled by <A HREF="26_1_Glossary.html#before_method"
><EM CLASS="term"
>before methods</EM
></A
> for <A HREF="f_update-instance-for-redefined-class.html" CLASS="funref"
><B
>update-instance-for-redefined-class</B
></A
> will not be evaluated by <A HREF="f_shared-initialize.html" CLASS="funref"
><B
>shared-initialize</B
></A
>. </P
><P CLASS="j"
><A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>Methods</EM
></A
> for <A HREF="f_shared-initialize.html" CLASS="funref"
><B
>shared-initialize</B
></A
> may be defined to customize <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> redefinition. For more information, see <A HREF="7_1_Object_Creation_and_Initialization.html#sec_7_1_5" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>7.1.5</SPAN
> <SPAN CLASS="cmr"
>(Shared-Initialize)</SPAN
></A
>.</P
><H3 ID="sec_4_3_7" CLASS="HeadIII"
>4.3.7 Integrating Types and Classes</H3
><P CLASS="j"
>The object system maps the space of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> into the space of <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>types</EM
></A
>. Every <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that has a proper name has a corresponding <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> with the same <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
>. </P
><P CLASS="j"
>The proper name of every <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is a valid <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifier</EM
></A
>. In addition, every <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
> is a valid <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifier</EM
></A
>. Thus the expression <CODE CLASS="f"
>(typep <VAR CLASS="param"
>object</VAR
> <VAR CLASS="param"
>class</VAR
>)</CODE
> evaluates to <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 <VAR CLASS="param"
>object</VAR
> is <VAR CLASS="param"
>class</VAR
> itself or a <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclass</EM
></A
> of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. The evaluation of the expression <CODE CLASS="f"
>(subtypep class1 class2)</CODE
> returns the values <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
> and <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
> if <CODE CLASS="f"
>class1</CODE
> is a subclass of <CODE CLASS="f"
>class2</CODE
> or if they are the same <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>; otherwise it returns the values <A HREF="26_1_Glossary.html#false"
><EM CLASS="term"
>false</EM
></A
> and <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>. If <I
>I</I
> is an <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instance</EM
></A
> of some <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <I
>C</I
> named <I
>S</I
> and <I
>C</I
> 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
>, the evaluation of the expression <CODE CLASS="f"
>(type-of <I
>I</I
>)</CODE
> returns <I
>S</I
> if <I
>S</I
> is the <A HREF="26_1_Glossary.html#proper_name"
><EM CLASS="term"
>proper name</EM
></A
> of <I
>C</I
>; otherwise, it returns <I
>C</I
>. </P
><P CLASS="j"
>Because the names of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> and <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>objects</EM
></A
> are <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifiers</EM
></A
>, they may be used in the special form <A HREF="f_the.html" CLASS="specref"
><B
>the</B
></A
> and in type declarations. </P
><P CLASS="j"
>Many but not all of the predefined <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifiers</EM
></A
> have a corresponding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> with the same proper name as the <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
>. These type specifiers are listed in Figure&#160;4&#8211;8. For example, the <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="t_array.html" CLASS="typeref"
><B
>array</B
></A
> has a corresponding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> named <A HREF="t_array.html" CLASS="typeref"
><B
>array</B
></A
>. No <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifier</EM
></A
> that is a list, such as <SPAN CLASS="cmtt"
>(vector</SPAN
> <SPAN CLASS="cmtt"
>double-float</SPAN
> <SPAN CLASS="cmtt"
>100)</SPAN
>, has a corresponding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. The <A HREF="26_1_Glossary.html#operator"
><EM CLASS="term"
>operator</EM
></A
> <A HREF="f_deftype.html" CLASS="macref"
><B
>deftype</B
></A
> does not create any <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
>. </P
><P CLASS="j"
>Each <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that corresponds to a predefined <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifier</EM
></A
> can be implemented in one of three ways, at the discretion of each implementation. It can be a <A HREF="26_1_Glossary.html#standard_class"
><EM CLASS="term"
>standard class</EM
></A
>, a <A HREF="26_1_Glossary.html#structure_class"
><EM CLASS="term"
>structure class</EM
></A
>, or a <A HREF="26_1_Glossary.html#system_class"
><EM CLASS="term"
>system class</EM
></A
>. </P
><P CLASS="j"
>A <A HREF="26_1_Glossary.html#built-in_class"
><EM CLASS="term"
>built-in class</EM
></A
> is one whose <A HREF="26_1_Glossary.html#generalized_instance"
><EM CLASS="term"
>generalized instances</EM
></A
> have restricted capabilities or special representations. Attempting to use <A HREF="f_defclass.html" CLASS="macref"
><B
>defclass</B
></A
> to define <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclasses</EM
></A
> of a <A HREF="t_built-in-class.html" CLASS="typeref"
><B
>built-in-class</B
></A
> signals an error. Calling <A HREF="f_make-instance.html" CLASS="funref"
><B
>make-instance</B
></A
> to create a <A HREF="26_1_Glossary.html#generalized_instance"
><EM CLASS="term"
>generalized instance</EM
></A
> of a <A HREF="26_1_Glossary.html#built-in_class"
><EM CLASS="term"
>built-in class</EM
></A
> signals an error. Calling <A HREF="f_slot-value.html" CLASS="funref"
><B
>slot-value</B
></A
> on a <A HREF="26_1_Glossary.html#generalized_instance"
><EM CLASS="term"
>generalized instance</EM
></A
> of a <A HREF="26_1_Glossary.html#built-in_class"
><EM CLASS="term"
>built-in class</EM
></A
> signals an error. Redefining a <A HREF="26_1_Glossary.html#built-in_class"
><EM CLASS="term"
>built-in class</EM
></A
> or using <A HREF="f_change-class.html" CLASS="funref"
><B
>change-class</B
></A
> to change the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> of an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> to or from a <A HREF="26_1_Glossary.html#built-in_class"
><EM CLASS="term"
>built-in class</EM
></A
> signals an error. However, <A HREF="26_1_Glossary.html#built-in_class"
><EM CLASS="term"
>built-in classes</EM
></A
> can be used as <A HREF="26_1_Glossary.html#parameter_specializer"
><EM CLASS="term"
>parameter specializers</EM
></A
> in <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
>. </P
><P CLASS="j"
>It is possible to determine whether a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is a <A HREF="26_1_Glossary.html#built-in_class"
><EM CLASS="term"
>built-in class</EM
></A
> by checking the <A HREF="26_1_Glossary.html#metaclass"
><EM CLASS="term"
>metaclass</EM
></A
>. A <A HREF="26_1_Glossary.html#standard_class"
><EM CLASS="term"
>standard class</EM
></A
> is 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
> <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
>, a <A HREF="26_1_Glossary.html#built-in_class"
><EM CLASS="term"
>built-in class</EM
></A
> is 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
> <A HREF="t_built-in-class.html" CLASS="typeref"
><B
>built-in-class</B
></A
>, and a <A HREF="26_1_Glossary.html#structure_class"
><EM CLASS="term"
>structure class</EM
></A
> is 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
> <A HREF="t_structure-class.html" CLASS="typeref"
><B
>structure-class</B
></A
>. </P
><P CLASS="j"
>Each <A HREF="26_1_Glossary.html#structure"
><EM CLASS="term"
>structure</EM
></A
> <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> created by <A HREF="f_defstruct.html" CLASS="macref"
><B
>defstruct</B
></A
> without using the <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:type</SPAN
></SPAN
> option has a corresponding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. This <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is a <A HREF="26_1_Glossary.html#generalized_instance"
><EM CLASS="term"
>generalized instance</EM
></A
> of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> <A HREF="t_structure-class.html" CLASS="typeref"
><B
>structure-class</B
></A
>. The <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:include</SPAN
></SPAN
> option of <A HREF="f_defstruct.html" CLASS="macref"
><B
>defstruct</B
></A
> creates a direct <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclass</EM
></A
> of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> that corresponds to the included <A HREF="26_1_Glossary.html#structure"
><EM CLASS="term"
>structure</EM
></A
> <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
>. </P
><P CLASS="j"
>It is <A HREF="26_1_Glossary.html#implementation-dependent"
><EM CLASS="term"
>implementation-dependent</EM
></A
> whether <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> are involved in the operation of <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>functions</EM
></A
> defined in this specification on <A HREF="26_1_Glossary.html#instance"
><EM CLASS="term"
>instances</EM
></A
> of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> defined in this specification, except when <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> are explicitly defined by this specification. </P
><P CLASS="j"
>If in a particular <A HREF="26_1_Glossary.html#implementation"
><EM CLASS="term"
>implementation</EM
></A
> a <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> defined in this specification has <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> that are not defined by this specfication, the names of these <A HREF="26_1_Glossary.html#slot"
><EM CLASS="term"
>slots</EM
></A
> must not be <A HREF="26_1_Glossary.html#external_symbol"
><EM CLASS="term"
>external symbols</EM
></A
> of <A HREF="26_1_Glossary.html#package"
><EM CLASS="term"
>packages</EM
></A
> defined in this specification nor otherwise <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> in the <SPAN CLASS="packref"
><SPAN CLASS="cmtt"
>CL-USER</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#package"
><EM CLASS="term"
>package</EM
></A
>. </P
><P CLASS="j"
>The purpose of specifying that many of the standard <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifiers</EM
></A
> have a corresponding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> is to enable users to write <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>methods</EM
></A
> that discriminate on these <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>types</EM
></A
>. <A HREF="26_1_Glossary.html#method"
><EM CLASS="term"
>Method</EM
></A
> selection requires that a <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> can be determined for each <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. </P
><P CLASS="j"
>The hierarchical relationships among the <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifiers</EM
></A
> are mirrored by relationships among the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> corresponding to those <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>types</EM
></A
>. </P
><P CLASS="j"
>Figure&#160;4&#8211;8 lists the set of <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> that correspond to predefined <A HREF="26_1_Glossary.html#type_specifier"
><EM CLASS="term"
>type specifiers</EM
></A
>.</P
><DIV CLASS="displaythree"
><FIGURE CLASS="boxfig"
><DIV CLASS="figbody"
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
><TBODY
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
><A HREF="t_arithmetic-error.html" CLASS="typeref"
><B
>arithmetic-error</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_generic-function.html" CLASS="typeref"
><B
>generic-function</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_simple-error.html" CLASS="typeref"
><B
>simple-error</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_array.html" CLASS="typeref"
><B
>array</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_hash-table.html" CLASS="typeref"
><B
>hash-table</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_simple-type-error.html" CLASS="typeref"
><B
>simple-type-error</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_bit-vector.html" CLASS="typeref"
><B
>bit-vector</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_integer.html" CLASS="typeref"
><B
>integer</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_simple-warning.html" CLASS="typeref"
><B
>simple-warning</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_broadcast-stream.html" CLASS="typeref"
><B
>broadcast-stream</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_list.html" CLASS="typeref"
><B
>list</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_standard-class.html" CLASS="typeref"
><B
>standard-class</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_built-in-class.html" CLASS="typeref"
><B
>built-in-class</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_logical-pathname.html" CLASS="typeref"
><B
>logical-pathname</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_standard-generic-function.html" CLASS="typeref"
><B
>standard-generic-function</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_cell-error.html" CLASS="typeref"
><B
>cell-error</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_method.html" CLASS="typeref"
><B
>method</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_standard-method.html" CLASS="typeref"
><B
>standard-method</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_character.html" CLASS="typeref"
><B
>character</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_method-combination.html" CLASS="typeref"
><B
>method-combination</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_standard-object.html" CLASS="typeref"
><B
>standard-object</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_class.html" CLASS="typeref"
><B
>class</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_null.html" CLASS="typeref"
><B
>null</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_storage-condition.html" CLASS="typeref"
><B
>storage-condition</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_complex.html" CLASS="typeref"
><B
>complex</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_number.html" CLASS="typeref"
><B
>number</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_stream.html" CLASS="typeref"
><B
>stream</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_concatenated-stream.html" CLASS="typeref"
><B
>concatenated-stream</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_package.html" CLASS="typeref"
><B
>package</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_stream-error.html" CLASS="typeref"
><B
>stream-error</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_condition.html" CLASS="typeref"
><B
>condition</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_package-error.html" CLASS="typeref"
><B
>package-error</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_string.html" CLASS="typeref"
><B
>string</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_cons.html" CLASS="typeref"
><B
>cons</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_parse-error.html" CLASS="typeref"
><B
>parse-error</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_string-stream.html" CLASS="typeref"
><B
>string-stream</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_control-error.html" CLASS="typeref"
><B
>control-error</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_pathname.html" CLASS="typeref"
><B
>pathname</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_structure-class.html" CLASS="typeref"
><B
>structure-class</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_division-by-zero.html" CLASS="typeref"
><B
>division-by-zero</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_print-not-readable.html" CLASS="typeref"
><B
>print-not-readable</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_structure-object.html" CLASS="typeref"
><B
>structure-object</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_echo-stream.html" CLASS="typeref"
><B
>echo-stream</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_program-error.html" CLASS="typeref"
><B
>program-error</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_style-warning.html" CLASS="typeref"
><B
>style-warning</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_end-of-file.html" CLASS="typeref"
><B
>end-of-file</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_random-state.html" CLASS="typeref"
><B
>random-state</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_symbol.html" CLASS="typeref"
><B
>symbol</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_error.html" CLASS="typeref"
><B
>error</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_ratio.html" CLASS="typeref"
><B
>ratio</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_synonym-stream.html" CLASS="typeref"
><B
>synonym-stream</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_file-error.html" CLASS="misc"
><B
>file-</B
><A HREF="t_error.html" CLASS="typeref"
><B
>error</B
></A
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_rational.html" CLASS="typeref"
><B
>rational</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_t.html" CLASS="typeref"
><B
>t</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_file-stream.html" CLASS="typeref"
><B
>file-stream</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_reader-error.html" CLASS="typeref"
><B
>reader-error</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_two-way-stream.html" CLASS="typeref"
><B
>two-way-stream</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_float.html" CLASS="typeref"
><B
>float</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_readtable.html" CLASS="typeref"
><B
>readtable</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_type-error.html" CLASS="typeref"
><B
>type-error</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_floating-point-inexact.html" CLASS="typeref"
><B
>floating-point-inexact</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_real.html" CLASS="typeref"
><B
>real</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_unbound-slot.html" CLASS="typeref"
><B
>unbound-slot</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_floating-point-invalid-operation.html" CLASS="typeref"
><B
>floating-point-invalid-operation</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_restart.html" CLASS="typeref"
><B
>restart</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_unbound-variable.html" CLASS="typeref"
><B
>unbound-variable</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_floating-point-overflow.html" CLASS="typeref"
><B
>floating-point-overflow</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_sequence.html" CLASS="typeref"
><B
>sequence</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_undefined-function.html" CLASS="typeref"
><B
>undefined-function</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_floating-point-underflow.html" CLASS="typeref"
><B
>floating-point-underflow</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_serious-condition.html" CLASS="typeref"
><B
>serious-condition</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_vector.html" CLASS="typeref"
><B
>vector</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="t_function.html" CLASS="typeref"
><B
>function</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="t_simple-condition.html" CLASS="typeref"
><B
>simple-condition</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="t_warning.html" CLASS="typeref"
><B
>warning</B
></A
></TD
></TR
></TBODY
></TABLE
></DIV
><FIGCAPTION CLASS="caption"
><B
>Figure 4&#8211;8. Classes that correspond to pre-defined type specifiers</B
></FIGCAPTION
></FIGURE
></DIV
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence list</EM
></A
> information specified in the entries for each of these <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> are those that are required by the object system. </P
><P CLASS="j"
>Individual implementations may be extended to define other type specifiers to have a corresponding <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
>. Individual implementations may be extended to add other <A HREF="26_1_Glossary.html#subclass"
><EM CLASS="term"
>subclass</EM
></A
> relationships and to add other <A HREF="26_1_Glossary.html#element"
><EM CLASS="term"
>elements</EM
></A
> to the <A HREF="26_1_Glossary.html#class_precedence_list"
><EM CLASS="term"
>class precedence lists</EM
></A
> as long as they do not violate the type relationships and disjointness requirements specified by this standard. A standard <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>class</EM
></A
> defined with no direct <A HREF="26_1_Glossary.html#superclass"
><EM CLASS="term"
>superclasses</EM
></A
> is guaranteed to be disjoint from all of the <A HREF="26_1_Glossary.html#class"
><EM CLASS="term"
>classes</EM
></A
> in the table, except for the class named <A HREF="t_t.html" CLASS="typeref"
><B
>t</B
></A
>.</P
></SECTION
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="4_2_Types.html" CLASS="prev"
>&#8592;</A
><A HREF="4_4_Types_and_Classes_Dictionary.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
>