src/builtin.lisp: Bind `me' around slot initializers, and define the order.
[sod] / doc / concepts.tex
index 39cccb8..f5e3a2f 100644 (file)
@@ -259,6 +259,17 @@ expressions if the generated code is expected to be processed by a
 implementation of C89.  Initializers will be evaluated once each time an
 instance is initialized.
 
+Slots are initialized in reverse-precedence order of their defining classes;
+i.e., slots defined by a less specific superclass are initialized earlier
+than slots defined by a more specific superclass.  Slots defined by the same
+class are initialized in the order in which they appear in the class
+definition.
+
+The initializer for a slot may refer to other slots in the same object, via
+the @|me| pointer: in an initializer for a slot defined by a class $C$, @|me|
+has type `pointer to $C$'.  (Note that the type of @|me| depends only on the
+class which defined the slot, not the class which defined the initializer.)
+
 
 \subsection{C language integration} \label{sec:concepts.classes.c}
 
@@ -736,6 +747,14 @@ superclasses.  This default behaviour may be invoked multiple times if some
 method calls on its @|next_method| more than once, unless some other method
 takes steps to prevent this.
 
+Slots are initialized in a well-defined order.
+\begin{itemize}
+\item Slots defined by a more specific superclasses are initialized after
+  slots defined by a less specific superclass.
+\item Slots defined by the same class are initialized in the order in which
+  their definitions appear.
+\end{itemize}
+
 The recommended way to add new initialization behaviour is to define @|after|
 methods on the @|init| message.  These will be run after the slot
 initializers have been applied, in reverse precedence order.