%%%----- Licensing notice ---------------------------------------------------
%%%
-%%% This file is part of the Sensble Object Design, an object system for C.
+%%% This file is part of the Sensible Object Design, an object system for C.
%%%
%%% SOD is free software; you can redistribute it and/or modify
%%% it under the terms of the GNU General Public License as published by
In order to resolve inheritance of items, we define a \emph{class precedence
list} (or CPL) for each class, which imposes a total order on that class's
superclasses. The default algorithm for computing the CPL is the \emph{C3}
-algorithm \cite{fixme-c3}, though extensions may implement other algorithms.
+algorithm \cite{barrett-1996:monot-super-linear-dylan}, though extensions may
+implement other algorithms.
The default algorithm works as follows. Let $C$ be the class whose CPL we
are to compute. Let $X$ and $Y$ be two of $C$'s superclasses.
%% things to talk about:
%% Liskov substitution principle and why it's mad
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ [rounded corners=4mm, x=6mm, y=-15mm, align=center]
+ \node[lit] (obj) at (0, 0) {Object};
+ \node[lit] (objcls) at (6, 0) {Object class};
+ \node[lit] (bhv) at (0, 1) {Behavior};
+ \node[lit] (bhvcls) at (6, 1) {Behavior class};
+ \node[lit] (cld) at (0, 2) {ClassDescription};
+ \node[lit] (cldcls) at (6, 2) {ClassDescription class};
+ \node[lit] (cls) at (-3, 3) {Class};
+ \node[lit] (clscls) at (1, 3) {Class \\ class};
+ \node[lit] (mtc) at (5, 3) {Metaclass};
+ \node[lit] (mtccls) at (9, 3) {Metaclass class};
+
+ \coordinate (t) at ($ (obj.north) + (0mm, 5mm) $);
+ \coordinate (b) at ($ (mtc.south) - (0mm, 8mm) $);
+ \coordinate (l) at ($ (cls.west) - (5mm, 0mm) $);
+ \coordinate (r) at ($ (mtccls.east) + (5mm, 0mm) $);
+
+ \foreach \n/\p in {bhv/obj, cld/bhv, cls/cld, mtc/cld}
+ { \draw[->] (\n) to (\p); \draw[->] (\n cls) to (\p cls); }
+ \draw[->] (objcls)
+ -- (t -| objcls.center)
+ -- (t -| l)
+ -- (cls.center -| l)
+ -- (cls);
+
+ \foreach \n in {obj, bhv, cld, cls}
+ \draw[->, dashed] (\n) to (\n cls);
+ \foreach \n/\c in {mtc/mtccls, mtccls/mtc}
+ \draw[->, dashed] (\n) to[bend right] (\c);
+ \draw[->, dashed] (clscls) -- (mtc);
+ \draw[->, dashed] (objcls)
+ -- (objcls.center -| r)
+ -- (b -| r)
+ -- (b -| mtc.center)
+ -- (mtc);
+ \foreach \c in {bhv, cld}
+ \draw[dashed] (\c cls) -- (\c cls.center -| r) -- +(0mm, -5mm);
+ \end{tikzpicture}
+
+ \bigskip
+
+ \hbox to\hsize{\hss
+ \fbox{\ \begin{tikzpicture}
+ \node (subclass) {subclass of};
+ \node (instance) [below=\jot of subclass] {instance of};
+ \draw [->] ($(subclass.west) - (10mm, 0)$) -- ++(8mm, 0);
+ \draw [->, dashed] ($(instance.west) - (10mm, 0)$) -- ++(8mm, 0);
+ \end{tikzpicture}}}
+ \caption{The Smalltalk braid}
+\end{figure}
+
%%%----- That's all, folks --------------------------------------------------
%%% Local variables: