1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Body/04_ce.htm
2024-04-01 10:24:07 +02:00

41 lines
5.4 KiB
HTML

<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
<HTML>
<HEAD>
<TITLE>CLHS: Section 4.3.5</TITLE>
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
<LINK REL=TOP HREF="../Front/index.htm">
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
<LINK REL=PREV HREF="04_cdb.htm">
<LINK REL=UP HREF="04_c.htm">
<LINK REL=NEXT HREF="04_cea.htm">
</HEAD>
<BODY>
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="04_cdb.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="04_c.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="04_cea.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>
4.3.5 Determining the Class Precedence List</H2> <P>
The <A REL=DEFINITION HREF="m_defcla.htm#defclass"><B>defclass</B></A> form for a <A REL=DEFINITION HREF="26_glo_c.htm#class"><I>class</I></A> provides a total ordering on that <A REL=DEFINITION HREF="26_glo_c.htm#class"><I>class</I></A> and its direct <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A>. This ordering is called the <A REL=DEFINITION HREF="26_glo_l.htm#local_precedence_order"><I>local precedence order</I></A>. It is an ordered list of the <A REL=DEFINITION HREF="26_glo_c.htm#class"><I>class</I></A> and its direct <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A>. The <A REL=DEFINITION HREF="26_glo_c.htm#class_precedence_list"><I>class precedence list</I></A> for a class C is a total ordering on C and its <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A> that is consistent with the <A REL=DEFINITION HREF="26_glo_l.htm#local_precedence_order"><I>local precedence orders</I></A> for each of C and its <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A>. <P>
A <A REL=DEFINITION HREF="26_glo_c.htm#class"><I>class</I></A> precedes its direct <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A>, and a direct <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclass</I></A> precedes all other direct <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A> specified to its right in the <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A> list of the <A REL=DEFINITION HREF="m_defcla.htm#defclass"><B>defclass</B></A> form. For every class C, define <P> RC={(C,C1),(C1,C2),...,(Cn-1,Cn)}<P> where C1,...,Cn are the direct <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A> of C in the order in which they are mentioned in the <A REL=DEFINITION HREF="m_defcla.htm#defclass"><B>defclass</B></A> form. These ordered pairs generate the total ordering on the class C and its direct <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A>. <P>
Let SC be the set of C and its <A REL=DEFINITION HREF="26_glo_s.htm#superclass"><I>superclasses</I></A>. Let R be <P> R=Uc&lt;ELEMENT-OF&gt;SCRc<P>. <P>
The set R might or might not generate a partial ordering, depending on whether the Rc, c&lt;ELEMENT-OF&gt;SC, are consistent; it is assumed that they are consistent and that R generates a partial ordering. When the Rc are not consistent, it is said that R is inconsistent. <P>
To compute the <A REL=DEFINITION HREF="26_glo_c.htm#class_precedence_list"><I>class precedence list</I></A> for C, topologically sort the elements of SC with respect to the partial ordering generated by R. When the topological sort must select a <A REL=DEFINITION HREF="26_glo_c.htm#class"><I>class</I></A> from a set of two or more <A REL=DEFINITION HREF="26_glo_c.htm#class"><I>classes</I></A>, none of which are preceded by other <A REL=DEFINITION HREF="26_glo_c.htm#class"><I>classes</I></A> with respect to R, the <A REL=DEFINITION HREF="26_glo_c.htm#class"><I>class</I></A> selected is chosen deterministically, as described below. <P>
If R is inconsistent, an error is signaled. <P>
<P>
<A REL=CHILD HREF="04_cea.htm"><H2>
4.3.5.1 Topological Sorting</H2></A><P>
<A REL=CHILD HREF="04_ceb.htm"><H2>
4.3.5.2 Examples of Class Precedence List Determination</H2></A><P><HR>
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
</BODY>
</HTML>