From e1f775a8531686c1217e04b028471bd4e8db4680 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 3 Aug 2019 16:49:55 +0100 Subject: [PATCH] doc/concepts.tex: Add some clarifications about initargs. --- doc/concepts.tex | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/concepts.tex b/doc/concepts.tex index e7a6c15..6ec27b9 100644 --- a/doc/concepts.tex +++ b/doc/concepts.tex @@ -1044,7 +1044,8 @@ defines a name, type, and (optionally) a default value for the initarg. slot or slot initializer item: the property's value determines the initarg's name, while the type is taken from the underlying slot type; slot initargs do not have default values. Both kinds define a \emph{direct initarg} for the -containing class. +containing class. (Note that a slot may have any number of slot initargs; +and any number of slots may have initargs with the same name.) Initargs are inherited. The \emph{applicable} direct initargs for an @|init| effective method are those defined by the receiving object's class, and all @@ -1065,15 +1066,21 @@ definitions influence the initialization of slots. The process for deciding how to initialize a particular slot works as follows. \begin{enumerate} + \item If there are any slot initargs defined on the slot, or any of its slot initializers, \emph{and} the sender supplied a value for one or more of the - corresponding effective initargs, then the value of the most specific slot - initarg is stored in the slot. + corresponding effective initargs, then the value of the most specific such + initarg is stored in the slot. (For this purpose, initargs defined earlier + in a class definition are more specific than initargs defined later.) + \item Otherwise, if there are any slot initializers defined which include an initializer expression, then the initializer expression from the most specific such slot initializer is evaluated and its value stored in the - slot. + slot. (A class may define at most one initializer for any particular slot, + so no further disambiguation is required.) + \item Otherwise, the slot is left uninitialized. + \end{enumerate} Note that the default values (if any) of effective initargs do \emph{not} affect this procedure. -- 2.11.0