413 lines
No EOL
9.2 KiB
HTML
413 lines
No EOL
9.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<HTML LANG="en-us"
|
|
><HEAD
|
|
><TITLE
|
|
>4.1 Introduction | Common Lisp Nova Spec</TITLE
|
|
><META CHARSET="US-ASCII"
|
|
><LINK REL="canonical" HREF="4_1_Introduction.html"
|
|
><LINK REL="next" HREF="4_2_Types.html" TYPE="text/html" TITLE="4.2 Types"
|
|
><LINK REL="prev" HREF="4_Types_and_Classes.html" TYPE="text/html" TITLE="4. Types and Classes"
|
|
><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
|
|
></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"
|
|
>→ <A HREF="4_Types_and_Classes.html"
|
|
>4. Types and Classes</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="4_1_Introduction.html"
|
|
>4.1 Introduction</A
|
|
></SPAN
|
|
></DIV
|
|
><DIV CLASS="apropos"
|
|
><DIV CLASS="apropos-io"
|
|
><A HREF="4_Types_and_Classes.html" CLASS="prev"
|
|
>←</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_2_Types.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV ID="apropos-res"
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="matter"
|
|
><SECTION
|
|
><H2 ID="sec_4_1" CLASS="HeadII"
|
|
>4.1 Introduction</H2
|
|
><UL CLASS="subtoc"
|
|
></UL
|
|
><P CLASS="j"
|
|
>A <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> is a (possibly infinite) set of <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>objects</EM
|
|
></A
|
|
>. An <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
> can belong to more than one <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
>. <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>Types</EM
|
|
></A
|
|
> are never explicitly represented as <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>objects</EM
|
|
></A
|
|
> by Common Lisp. Instead, they are referred to indirectly by the use of <A HREF="26_1_Glossary.html#type_specifier"
|
|
><EM CLASS="term"
|
|
>type specifiers</EM
|
|
></A
|
|
>, which are <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>objects</EM
|
|
></A
|
|
> that denote <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>types</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>New <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>types</EM
|
|
></A
|
|
> can be defined using <A HREF="f_deftype.html" CLASS="macref"
|
|
><B
|
|
>deftype</B
|
|
></A
|
|
>, <A HREF="f_defstruct.html" CLASS="macref"
|
|
><B
|
|
>defstruct</B
|
|
></A
|
|
>, <A HREF="f_defclass.html" CLASS="macref"
|
|
><B
|
|
>defclass</B
|
|
></A
|
|
>, and <A HREF="f_define-condition.html" CLASS="macref"
|
|
><B
|
|
>define-condition</B
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>The <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
> <A HREF="f_typep.html" CLASS="funref"
|
|
><B
|
|
>typep</B
|
|
></A
|
|
>, a set membership test, is used to determine whether a given <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
> is of a given <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
>. The function <A HREF="f_subtypep.html" CLASS="funref"
|
|
><B
|
|
>subtypep</B
|
|
></A
|
|
>, a subset test, is used to determine whether a given <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> is a <A HREF="26_1_Glossary.html#subtype"
|
|
><EM CLASS="term"
|
|
>subtype</EM
|
|
></A
|
|
> of another given <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
>. The function <A HREF="f_type-of.html" CLASS="funref"
|
|
><B
|
|
>type-of</B
|
|
></A
|
|
> returns a particular <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> to which a given <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
> belongs, even though that <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
> must belong to one or more other <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>types</EM
|
|
></A
|
|
> as well. (For example, every <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
> is of <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> <A HREF="t_t.html" CLASS="typeref"
|
|
><B
|
|
>t</B
|
|
></A
|
|
>, but <A HREF="f_type-of.html" CLASS="funref"
|
|
><B
|
|
>type-of</B
|
|
></A
|
|
> always returns a <A HREF="26_1_Glossary.html#type_specifier"
|
|
><EM CLASS="term"
|
|
>type specifier</EM
|
|
></A
|
|
> for a <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> more specific than <A HREF="t_t.html" CLASS="typeref"
|
|
><B
|
|
>t</B
|
|
></A
|
|
>.) </P
|
|
><P CLASS="j"
|
|
><A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>Objects</EM
|
|
></A
|
|
>, not <A HREF="26_1_Glossary.html#variable"
|
|
><EM CLASS="term"
|
|
>variables</EM
|
|
></A
|
|
>, have <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>types</EM
|
|
></A
|
|
>. Normally, any <A HREF="26_1_Glossary.html#variable"
|
|
><EM CLASS="term"
|
|
>variable</EM
|
|
></A
|
|
> can have any <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
> as its <A HREF="26_1_Glossary.html#value"
|
|
><EM CLASS="term"
|
|
>value</EM
|
|
></A
|
|
>. It is possible to declare that a <A HREF="26_1_Glossary.html#variable"
|
|
><EM CLASS="term"
|
|
>variable</EM
|
|
></A
|
|
> takes on only values of a given <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> by making an explicit <A HREF="26_1_Glossary.html#type_declaration"
|
|
><EM CLASS="term"
|
|
>type declaration</EM
|
|
></A
|
|
>. <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>Types</EM
|
|
></A
|
|
> are arranged in a directed acyclic graph, except for the presence of equivalences. </P
|
|
><P CLASS="j"
|
|
><A HREF="26_1_Glossary.html#declaration"
|
|
><EM CLASS="term"
|
|
>Declarations</EM
|
|
></A
|
|
> can be made about <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>types</EM
|
|
></A
|
|
> using <A HREF="m_declare.html" CLASS="misc"
|
|
><B
|
|
>declare</B
|
|
></A
|
|
>, <A HREF="f_proclaim.html" CLASS="funref"
|
|
><B
|
|
>proclaim</B
|
|
></A
|
|
>, <A HREF="f_declaim.html" CLASS="macref"
|
|
><B
|
|
>declaim</B
|
|
></A
|
|
>, or <A HREF="f_the.html" CLASS="specref"
|
|
><B
|
|
>the</B
|
|
></A
|
|
>. For more information about <A HREF="26_1_Glossary.html#declaration"
|
|
><EM CLASS="term"
|
|
>declarations</EM
|
|
></A
|
|
>, see <A HREF="3_3_Declarations.html#sec_3_3" CLASS="secref"
|
|
><SPAN CLASS="cmr"
|
|
>Section</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>3.3</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>(Declarations)</SPAN
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>Among the fundamental <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>objects</EM
|
|
></A
|
|
> of the object system are <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
|
|
> 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 <A HREF="26_1_Glossary.html#instance"
|
|
><EM CLASS="term"
|
|
>instances</EM
|
|
></A
|
|
>. Every <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
> is a <A HREF="26_1_Glossary.html#direct_instance"
|
|
><EM CLASS="term"
|
|
>direct instance</EM
|
|
></A
|
|
> of a <A HREF="26_1_Glossary.html#class"
|
|
><EM CLASS="term"
|
|
>class</EM
|
|
></A
|
|
>. 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
|
|
> determines the set of operations that can be performed on the <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
>. For more information, see <A HREF="4_3_Classes.html#sec_4_3" CLASS="secref"
|
|
><SPAN CLASS="cmr"
|
|
>Section</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>4.3</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>(Classes)</SPAN
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>It is possible to write <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>functions</EM
|
|
></A
|
|
> that have behavior <A HREF="26_1_Glossary.html#specialized"
|
|
><EM CLASS="term"
|
|
>specialized</EM
|
|
></A
|
|
> to the class of the <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>objects</EM
|
|
></A
|
|
> which are their <A HREF="26_1_Glossary.html#argument"
|
|
><EM CLASS="term"
|
|
>arguments</EM
|
|
></A
|
|
>. For more information, see <A HREF="7_6_Generic_Functions_and_Methods.html#sec_7_6" CLASS="secref"
|
|
><SPAN CLASS="cmr"
|
|
>Section</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>7.6</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>(Generic</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>Functions</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>and</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>Methods)</SPAN
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>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 called its <DFN CLASS="newterm"
|
|
><SPAN CLASS="cmbxsl"
|
|
>metaclass</SPAN
|
|
></DFN
|
|
><SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="metaclass"
|
|
></SPAN
|
|
>. For more information about <A HREF="26_1_Glossary.html#metaclass"
|
|
><EM CLASS="term"
|
|
>metaclasses</EM
|
|
></A
|
|
>, see <A HREF="7_4_Meta-Objects.html#sec_7_4" CLASS="secref"
|
|
><SPAN CLASS="cmr"
|
|
>Section</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>7.4</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>(Meta-Objects)</SPAN
|
|
></A
|
|
>.</P
|
|
></SECTION
|
|
></DIV
|
|
><DIV CLASS="footer"
|
|
><DIV CLASS="btmnav"
|
|
><A HREF="4_Types_and_Classes.html" CLASS="prev"
|
|
>←</A
|
|
><A HREF="4_2_Types.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV CLASS="trail"
|
|
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
|
|
></DIV
|
|
></DIV
|
|
><SCRIPT
|
|
>domReady();</SCRIPT
|
|
></BODY
|
|
></HTML
|
|
> |