\section{Formulations of the Law}


We give the formulation of the Law of Demeter 
(``object'' version) in a few object-oriented languages
Smalltalk-80 \cite{goldberg:smalltalk-l-i},
CLOS \cite{clos:87},
C++ \cite{stroustrup:c++},
Eiffel \cite{meyer:book-88}.
Each formulation adapts the Law to the terminology of the particular language.
For explanation and motivation see
\cite{karl-ian:formulations-88}.\\
\rule{81mm}{2mm}
{\bf Smalltalk-80:
For all methods M, and for all
message expressions in M
%objects to which M sends a message must be
%In all message expressions inside a method M 
the receiver must be one of the following objects:
\begin{itemize}
\item
an argument object of M including objects in 
      pseudo variables ``self'' and ``super'' or
\item
an instance variable object of the class to which M
      is attached.
\end{itemize}}
(Objects created by a method, or by methods which it calls, and objects in global 
variables are viewed as being passed by arguments.)\\
\rule{81mm}{2mm}
{\bf CLOS:
For all methods M, all
function calls inside M must use only 
the following objects as dynamic method selection arguments:
\begin{itemize}
\item
M's argument objects or
\item
a slot value of a dynamic method selection argument class of M.
\end{itemize}}
(Objects created by a method, or by functions which it calls,
and objects in global 
variables are viewed as being passed by arguments.
A dynamic method selection argument is an argument which is used
for identifying the applicable methods at run-time.)\\
Note: This version of the Law is currently under debate by some CLOS
developers and users.
\rule{81mm}{2mm}
{\bf C++:
For all classes C, and for all member functions M attached to C, all
objects to which M sends a message must be
%In any member function M defined for class C only send
%messages to the following objects:
\begin{itemize}
\item
M's argument objects, including the object pointed to by ``this'' or
\item
a data member object of class C.
\end{itemize}}
(Objects created by a member function, or by functions which it
calls and objects in global
variables are viewed as being passed by arguments.)\\
\rule{81mm}{2mm}
{\bf Eiffel:
For all routines M, and for all 
calls of routines inside M 
%In all calls of routines inside a routine M 
the entity object must be one of the following objects:
\begin{itemize}
\item
an argument object of M or
\item
an attribute object of the class in which M is defined.
\end{itemize}}
(Objects created by a routine, or by routines which it calls,
and objects in global 
variables are viewed as being passed by arguments.)
\noindent
\rule{81mm}{2mm}


