72 lines
4.7 KiB
HTML
72 lines
4.7 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.5. Determining the Class Precedence List</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" Determining the Class Precedence List">
|
||
|
<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=tex2html5082 HREF="node275.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5080 HREF="node261.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5074 HREF="node273.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5084 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5085 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html5083 HREF="node275.html"> Topological Sorting</A>
|
||
|
<B>Up:</B> <A NAME=tex2html5081 HREF="node261.html"> Programmer Interface Concepts</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html5075 HREF="node273.html"> Integrating Types and </A>
|
||
|
<HR> <P>
|
||
|
<H2><A NAME=SECTION003215000000000000000>28.1.5. Determining the Class Precedence List</A></H2>
|
||
|
<P>
|
||
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
||
|
<A NAME=DeterminingtheClassPrecedenceListSECTION>The</A>
|
||
|
<tt>defclass</tt> form for a class provides a total ordering on that
|
||
|
class and its direct superclasses. This ordering is called the <i>local precedence order</i>. It is an ordered list of the class and its
|
||
|
direct superclasses. The <i>class precedence list</i> for a
|
||
|
class <i>C</i> is a total ordering on <i>C</i> and its superclasses that is consistent
|
||
|
with the local precedence orders for <i>C</i> and its superclasses.
|
||
|
<P>
|
||
|
A class precedes its direct superclasses, and a
|
||
|
direct superclass precedes all other direct superclasses specified to
|
||
|
its right in the superclasses list of the <tt>defclass</tt> form. For
|
||
|
every class <i>C</i>, define
|
||
|
<P><IMG ALIGN=BOTTOM ALT="" SRC="_24769_displaymath43397.gif"><P>
|
||
|
where <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43399.gif"> are
|
||
|
the direct superclasses of <i>C</i> in the order in which
|
||
|
they are mentioned in the <tt>defclass</tt> form. These ordered pairs
|
||
|
generate the total ordering on the class <i>C</i> and its direct
|
||
|
superclasses.
|
||
|
<P>
|
||
|
Let <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43401.gif"> be the set of <i>C</i> and its superclasses. Let <i>R</i> be
|
||
|
<P><IMG ALIGN=BOTTOM ALT="" SRC="_24769_displaymath43403.gif"><P>
|
||
|
<P>
|
||
|
The set <i>R</i> may or may not generate a partial ordering, depending on
|
||
|
whether the <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43499.gif">, <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43407.gif">,
|
||
|
are consistent; it is assumed
|
||
|
that they are consistent and that <i>R</i> generates a partial ordering.
|
||
|
When the <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43499.gif"> are not consistent, it is said that <i>R</i> is inconsistent.
|
||
|
<P>
|
||
|
To compute the class precedence list for <i>C</i>,
|
||
|
topologically sort the elements of <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43435.gif"> with respect to the
|
||
|
partial ordering generated by <i>R</i>. When the topological
|
||
|
sort must select a class from a set of two or more classes, none of
|
||
|
which are preceded by other classes with respect to <i>R</i>,
|
||
|
the class selected is chosen deterministically, as described below.
|
||
|
If <i>R</i> is inconsistent, an error is signaled.
|
||
|
<P>
|
||
|
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
|
||
|
<HR>
|
||
|
<UL>
|
||
|
<LI> <A NAME=tex2html5086 HREF="node275.html#SECTION003215100000000000000"> Topological Sorting</A>
|
||
|
<LI> <A NAME=tex2html5087 HREF="node276.html#SECTION003215200000000000000"> Examples</A>
|
||
|
</UL>
|
||
|
<BR> <HR><A NAME=tex2html5082 HREF="node275.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5080 HREF="node261.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5074 HREF="node273.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5084 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5085 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html5083 HREF="node275.html"> Topological Sorting</A>
|
||
|
<B>Up:</B> <A NAME=tex2html5081 HREF="node261.html"> Programmer Interface Concepts</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html5075 HREF="node273.html"> Integrating Types and </A>
|
||
|
<HR> <P>
|
||
|
<HR>
|
||
|
<P><ADDRESS>
|
||
|
AI.Repository@cs.cmu.edu
|
||
|
</ADDRESS>
|
||
|
</BODY>
|