[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Law of good style for CLOS



    
    We have identified the following law of good style (known in-house
    as the Law of Demeter) for CLOS programmers:
    
    ----------------------------------------------------------------
    All generic function calls inside a method M must have
    one of the following objects passed by their first argument:
        a value of M's parameters (including self) or
        an immediate part of self.
    
    Objects created by the method and non-local objects
    are viewed as being transmitted by arguments.
    self is the name of the first argument of method M.
    ----------------------------------------------------------------
    
I have a better law of good style: someone writing Common Lisp code,
whether within a method or not, should not have to be aware of which calls
are generic and which are not.  Therefore it is unreasonable to lay down
laws about what the arguments to generic function calls may be.

Do you disagree with this?

-- Scott