\newpage \bv Object versions ----- LAW OF DEMETER FOR CLOS (object version) ----------- All function calls inside a method M must have one of the following objects passed by their method selection arguments: - a value of M's parameters or - an immediate part (the value of a slot) of a method selection argument of M. (Objects created by the method and objects in global variables are viewed as being passed by arguments. A method selection argument is an argument which is used for identifying the applicable methods.) ---------------------------------------------------------- User has to be aware of whether a function call is generic or not. Idea of Law: The user has only to think about the classes of the method selection arguments and the classes of the immediate subparts of those arguments when reading a method. -------------------- 2 ------------ In all function calls inside a method M all values of method selection arguments must be objects which are either passed by an argument of M or which are a value of an immediate part of a method selection argument of M. MESSAGE PASSING: only the first argument is a method selection argument ---------------------3-------------------------------------- In all function calls inside a method M all method selection arguments must belong to one of the following classes: - an argument class of M. - a class of an immediate part of a method selection argument of M. ------------------------4----------------------------------- In all function calls inside a method M all objects passed by method selection arguments must be instances of a class associated with one of the following classes: - argument classes - classes associated with instance variable classes of a method selection argument of M. -----------------------5------------------------------------ In all function calls inside a method M all objects passed by method selection arguments must have a most specific type from the following classes: - argument classes - instance variable classes of a method selection argument of M. -------------------------------- problem with alternations. \end{verbatim}