X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/b1254eb62a3ca4eb2839cd0f340d754f45d549a2..2e01fd8b00192c3ace8df389749e73c63b647a79:/doc/concepts.tex?ds=sidebyside diff --git a/doc/concepts.tex b/doc/concepts.tex index 9a77c44..c938c47 100644 --- a/doc/concepts.tex +++ b/doc/concepts.tex @@ -110,6 +110,7 @@ appropriate C declarations, tables, and functions. An object cannot (usually) change its direct class, and the direct class of an object is not affected by, for example, the static type of a pointer to it. + \subsection{Superclasses and inheritance} \label{sec:concepts.classes.inherit} @@ -232,6 +233,7 @@ Classes have a number of other attributes: then all the superclasses of $C$ must have distinct nicknames. \end{itemize} + \subsection{Slots} \label{sec:concepts.classes.slots} Each class defines a number of \emph{slots}. Much like a structure member, a @@ -257,6 +259,7 @@ 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. + \subsection{C language integration} \label{sec:concepts.classes.c} For each class~$C$, the Sod translator defines a C type, the \emph{class @@ -473,6 +476,7 @@ contains a copy of the direct method body. Within the body of a direct method defined for a class $C$, the variable @|me|, of type pointer to class type of $C$, refers to the receiving object. + \subsection{Effective methods and method combinations} \label{sec:concepts.methods.combination} @@ -621,14 +625,15 @@ The aggregating method combinations provided are as follows. \item[max] The message must return a scalar type. The applicable primary methods are invoked in turn. The final result is the largest of the individual values. -\item[and] The message must return @|int|. The applicable primary methods - are invoked in turn. If any method returns zero then the final result is - zero and no further methods are invoked. If all of the applicable primary - methods return nonzero, then the final result is a nonzero value. -\item[or] The message must return @|int|. The applicable primary methods are - invoked in turn. If any method returns nonzero then the final result is a - nonzero value and no further methods are invoked. If all of the applicable - primary methods return zero, then the final result is zero. +\item[and] The message must return a scalar type. The applicable primary + methods are invoked in turn. If any method returns zero then the final + result is zero and no further methods are invoked. If all of the + applicable primary methods return nonzero, then the final result is the + result of the last primary method. +\item[or] The message must return a scalar type. The applicable primary + methods are invoked in turn. If any method returns nonzero then the final + result is that nonzero value and no further methods are invoked. If all of + the applicable primary methods return zero, then the final result is zero. \end{description} There is also a @|custom| aggregating method combination, which is described