1
0
Fork 0
cl-sites/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node261.html
2023-10-25 11:23:21 +02:00

153 lines
10 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>28.1. Programmer Interface Concepts</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Programmer Interface Concepts">
<meta name="keywords" value="clm">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<b>Common Lisp the Language, 2nd Edition</b>
<BR> <HR><A NAME=tex2html4873 HREF="node262.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html4871 HREF="node260.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html4865 HREF="node260.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html4875 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html4876 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4874 HREF="node262.html"> Error Terminology</A>
<B>Up:</B> <A NAME=tex2html4872 HREF="node260.html"> Common Lisp Object </A>
<B> Previous:</B> <A NAME=tex2html4866 HREF="node260.html"> Common Lisp Object </A>
<HR> <P>
<H1><A NAME=SECTION003210000000000000000>28.1. Programmer Interface Concepts</A></H1>
<P>
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
The Common Lisp Object System (CLOS) is an object-oriented extension to Common Lisp. It is based on
generic functions, multiple inheritance, declarative method
combination, and a meta-object protocol.
<P>
The first two parts of this specification describe
the standard Programmer Interface for the Common Lisp Object System. The first part,
Programmer Interface Concepts,
contains a description of the concepts of the Common Lisp Object System, and the second part,
Functions in the Programmer Interface,
contains a description of the functions and macros in the Common Lisp Object System
Programmer Interface. The third part, The Common Lisp Object System Meta-Object
Protocol, explains how the Common Lisp Object System can be customized. [The third part
has not yet been approved by X3J13 for inclusion in the forthcoming
Common Lisp standard and is not included in this book.-GLS]
<P>
The fundamental objects of the Common Lisp Object System are classes, instances,
generic functions, and methods.
<P>
A <i>class</i> object determines the structure and behavior of a set
of other objects, which are called its <i>instances</i>.
Every Common Lisp object is an <i>instance</i> of a class. The class of an object determines the set of
operations that can be performed on the object.
<P>
A <i>generic function</i> is a function whose behavior depends on the
classes or identities of the arguments supplied to it. A generic
function object contains a set of methods, a lambda-list, a
method combination type, and other information. The <i>methods</i> define
the class-specific behavior and operations of the generic function; a
method is said to <i>specialize</i> a generic function. When invoked,
a generic function executes a subset of its methods based on the
classes of its arguments.
<P>
A generic function can be used in
the same ways as an ordinary function in Common Lisp; in
particular, a generic function can be used as an argument to
<tt>funcall</tt> and <tt>apply</tt> and can be given a global or a local name.
<P>
A <i>method</i> is an object that contains a method function, a sequence of
<i>parameter specializers</i> that specify when the given method is
applicable, and a sequence of <i>qualifiers</i> that is used by the
<i>method combination</i> facility to distinguish among methods. Each
required formal parameter of each method has an associated parameter
specializer, and the method will be invoked only on arguments that
satisfy its parameter specializers.
<P>
The method combination facility controls the selection of methods, the
order in which they are run, and the values that are returned by the
generic function. The Common Lisp Object System offers a default method combination type
and provides a facility for declaring new types of method combination.
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
<HR>
<UL>
<LI> <A NAME=tex2html4877 HREF="node262.html#SECTION003211000000000000000"> Error Terminology</A>
<LI> <A NAME=tex2html4878 HREF="node263.html#SECTION003212000000000000000"> Classes</A>
<UL>
<LI> <A NAME=tex2html4879 HREF="node264.html#SECTION003212100000000000000"> Defining Classes</A>
<LI> <A NAME=tex2html4880 HREF="node265.html#SECTION003212200000000000000"> Creating Instances of Classes</A>
<LI> <A NAME=tex2html4881 HREF="node266.html#SECTION003212300000000000000"> Slots</A>
<LI> <A NAME=tex2html4882 HREF="node267.html#SECTION003212400000000000000"> Accessing Slots</A>
</UL>
<LI> <A NAME=tex2html4883 HREF="node268.html#SECTION003213000000000000000"> Inheritance</A>
<UL>
<LI> <A NAME=tex2html4884 HREF="node269.html#SECTION003213100000000000000"> Inheritance of Methods</A>
<LI> <A NAME=tex2html4885 HREF="node270.html#SECTION003213200000000000000"> Inheritance of Slots and Slot Options</A>
<LI> <A NAME=tex2html4886 HREF="node271.html#SECTION003213300000000000000"> Inheritance of Class Options</A>
<LI> <A NAME=tex2html4887 HREF="node272.html#SECTION003213400000000000000"> Examples</A>
</UL>
<LI> <A NAME=tex2html4888 HREF="node273.html#SECTION003214000000000000000"> Integrating Types and Classes</A>
<LI> <A NAME=tex2html4889 HREF="node274.html#SECTION003215000000000000000"> Determining the Class Precedence List</A>
<UL>
<LI> <A NAME=tex2html4890 HREF="node275.html#SECTION003215100000000000000"> Topological Sorting</A>
<LI> <A NAME=tex2html4891 HREF="node276.html#SECTION003215200000000000000"> Examples</A>
</UL>
<LI> <A NAME=tex2html4892 HREF="node277.html#SECTION003216000000000000000"> Generic Functions and Methods</A>
<UL>
<LI> <A NAME=tex2html4893 HREF="node278.html#SECTION003216100000000000000"> Introduction to Generic Functions</A>
<LI> <A NAME=tex2html4894 HREF="node279.html#SECTION003216200000000000000"> Introduction to Methods</A>
<LI> <A NAME=tex2html4895 HREF="node280.html#SECTION003216300000000000000"> Agreement on Parameter Specializers and Qualifiers</A>
<LI> <A NAME=tex2html4896 HREF="node281.html#SECTION003216400000000000000"> Congruent Lambda-Lists for All Methods of a Generic Function</A>
<LI> <A NAME=tex2html4897 HREF="node282.html#SECTION003216500000000000000"> Keyword Arguments in Generic Functions and Methods</A>
</UL>
<LI> <A NAME=tex2html4898 HREF="node283.html#SECTION003217000000000000000"> Method Selection and Combination</A>
<UL>
<LI> <A NAME=tex2html4899 HREF="node284.html#SECTION003217100000000000000"> Determining the Effective Method</A>
<LI> <A NAME=tex2html4900 HREF="node285.html#SECTION003217200000000000000"> Standard Method Combination</A>
<LI> <A NAME=tex2html4901 HREF="node286.html#SECTION003217300000000000000"> Declarative Method Combination</A>
<LI> <A NAME=tex2html4902 HREF="node287.html#SECTION003217400000000000000"> Built-in Method Combination Types</A>
</UL>
<LI> <A NAME=tex2html4903 HREF="node288.html#SECTION003218000000000000000"> Meta-objects</A>
<UL>
<LI> <A NAME=tex2html4904 HREF="node289.html#SECTION003218100000000000000"> Metaclasses</A>
<LI> <A NAME=tex2html4905 HREF="node290.html#SECTION003218200000000000000"> Standard Metaclasses</A>
<LI> <A NAME=tex2html4906 HREF="node291.html#SECTION003218300000000000000"> Standard Meta-objects</A>
</UL>
<LI> <A NAME=tex2html4907 HREF="node292.html#SECTION003219000000000000000"> Object Creation and Initialization</A>
<UL>
<LI> <A NAME=tex2html4908 HREF="node293.html#SECTION003219100000000000000"> Initialization Arguments</A>
<LI> <A NAME=tex2html4909 HREF="node294.html#SECTION003219200000000000000"> Declaring the Validity of Initialization Arguments</A>
<LI> <A NAME=tex2html4910 HREF="node295.html#SECTION003219300000000000000"> Defaulting of Initialization Arguments</A>
<LI> <A NAME=tex2html4911 HREF="node296.html#SECTION003219400000000000000"> Rules for Initialization Arguments</A>
<LI> <A NAME=tex2html4912 HREF="node297.html#SECTION003219500000000000000"> Shared-Initialize</A>
<LI> <A NAME=tex2html4913 HREF="node298.html#SECTION003219600000000000000"> Initialize-Instance</A>
<LI> <A NAME=tex2html4914 HREF="node299.html#SECTION003219700000000000000"> Definitions of Make-Instance and Initialize-Instance</A>
</UL>
<LI> <A NAME=tex2html4915 HREF="node300.html#SECTION0032110000000000000000"> Redefining Classes</A>
<UL>
<LI> <A NAME=tex2html4916 HREF="node301.html#SECTION0032110100000000000000"> Modifying the Structure of Instances</A>
<LI> <A NAME=tex2html4917 HREF="node302.html#SECTION0032110200000000000000"> Initializing Newly Added Local Slots</A>
<LI> <A NAME=tex2html4918 HREF="node303.html#SECTION0032110300000000000000"> Customizing Class Redefinition</A>
<LI> <A NAME=tex2html4919 HREF="node304.html#SECTION0032110400000000000000"> Extensions</A>
</UL>
<LI> <A NAME=tex2html4920 HREF="node305.html#SECTION0032111000000000000000"> Changing the Class of an Instance</A>
<UL>
<LI> <A NAME=tex2html4921 HREF="node306.html#SECTION0032111100000000000000"> Modifying the Structure of an Instance</A>
<LI> <A NAME=tex2html4922 HREF="node307.html#SECTION0032111200000000000000"> Initializing Newly Added Local Slots</A>
<LI> <A NAME=tex2html4923 HREF="node308.html#SECTION0032111300000000000000"> Customizing the Change of Class of an Instance</A>
</UL>
<LI> <A NAME=tex2html4924 HREF="node309.html#SECTION0032112000000000000000"> Reinitializing an Instance</A>
<UL>
<LI> <A NAME=tex2html4925 HREF="node310.html#SECTION0032112100000000000000"> Customizing Reinitialization</A>
</UL>
</UL>
<BR> <HR><A NAME=tex2html4873 HREF="node262.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html4871 HREF="node260.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html4865 HREF="node260.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html4875 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html4876 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4874 HREF="node262.html"> Error Terminology</A>
<B>Up:</B> <A NAME=tex2html4872 HREF="node260.html"> Common Lisp Object </A>
<B> Previous:</B> <A NAME=tex2html4866 HREF="node260.html"> Common Lisp Object </A>
<HR> <P>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>