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

Re: accessor functions



    From: Alan Snyder <snyder%hplsny@hplabs.HP.COM>
    Subject: Re: accessor functions

      1. The most recent documentation I have indicates that the names
of
         accessor functions in both New Flavors and CommonLoops include
         the name of the class as a prefix (at least by default).  If
the
         accessor functions are generic, this extra "protection" against
         name conflicts would seem unnecessary and perhaps undesirable.
         What's the rationale for this default?

It is true that the default value for the "conc-name" is the name of the
class.  But in practice I tend to use the same conc-name for all the
classes in a class-tree.  As an example, in PCL the conc-name for
essential-class and all the classes which include it is "class-".  This
means that the accessor for the slots of any kind of class is
"CLASS-SLOTS".  When I see "(class-slots x)" in code, I read it as "x is
some kind of class, there will be a method on class-slots which knows
how to get x's slots.

While generic functions let you use a conc-name of nil I personally
don't like this style.  As an example, using conc-name nil would allow
the accessor for all things which have a name to be just "NAME".  I
prefer to see "(CLASS-NAME x)" because it tells me that x is some kind
of class.

Perhaps a more liberal use of packages or just the passage of time will
change my philosophy about this, I don't know.