\subsubsection{Slot initializers}
As well as defining slot names and types, a class can also associate an
\emph{initial value} with each slot defined by itself or one of its
-subclasses. A class $C$ provides an \emph{initialization function} (see
+subclasses. A class $C$ provides an \emph{initialization message} (see
\xref{sec:concepts.lifecycle.birth}, and \xref{sec:structures.root.sodclass})
-which sets the slots of a \emph{direct} instance of the class to the correct
-initial values. If several of $C$'s superclasses define initializers for the
-same slot then the initializer from the most specific such class is used. If
-none of $C$'s superclasses define an initializer for some slot then that slot
-will be left uninitialized.
+whose methods set the slots of a \emph{direct} instance of the class to the
+correct initial values. If several of $C$'s superclasses define initializers
+for the same slot then the initializer from the most specific such class is
+used. If none of $C$'s superclasses define an initializer for some slot then
+that slot will be left uninitialized.
The initializer for a slot with scalar type may be any C expression. The
initializer for a slot with aggregate type must contain only constant
Details of initialization are necessarily class-specific, but typically it
involves setting the instance's slots to appropriate values, and possibly
-linking it into some larger data structure to keep track of it.
+linking it into some larger data structure to keep track of it. It is
+possible for initialization methods to attempt to allocate resources, but
+this must be done carefully: there is currently no way to report an error
+from object initialization, so the object must be marked as incompletely
+initialized, and left in a state where it will be safe to tear down later.
Initialization is performed by sending the imprinted instance an @|init|
message, defined by the @|SodObject| class. This message uses a nonstandard
\descref{sod_destroy}[function]{fun}.
\subsubsection{Teardown}
-Details of initialization are necessarily class-specific, but typically it
-involves setting the instance's slots to appropriate values, and possibly
-linking it into some larger data structure to keep track of it.
+Details of teardown are necessarily class-specific, but typically it
+involves releasing resources held by the instance, and disentangling it from
+any data structures it might be linked into.
Teardown is performed by sending the instance the @|teardown| message,
defined by the @|SodObject| class. The message returns an integer, used as a
counting system, as follows.
\begin{prog}
[nick = ref] \\
- class ReferenceCountedObject \{ \\ \ind
+ class ReferenceCountedObject: SodObject \{ \\ \ind
unsigned nref = 1; \\-
void inc() \{ me@->ref.nref++; \} \\-
[role = around] \\