[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: accessor functions
Date: Thu, 24 Jul 86 14:50 EDT
From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
I and most (but not all!) of my users agree with this philosophy
and use it also.
Date: 23 Jul 86 13:27 PDT
From: Gregor Kiczales <Gregor.pa@Xerox.COM>
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.
Indeed, this does seem somewhat redundant with the package system.
Do you (and your users) also typically define a separate package for
an entire "class-tree"? If so, why not use CLASS:NAME instead of
CLASS-NAME?
Also, do you use the CLASS- prefix for ALL operations defined
on a CLASS, or just the instance variable accessor functions?
I notice in the SHIP example in the December 85 New Flavors paper that
the function SHIP-MASS is defined to read the MASS instance variable,
but the function SPEED (rather than SHIP-SPEED) is defined to
compute the speed. Is MASS less generic than SPEED?
Alan
-------