[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Two questions and two comments
- To: CommonLoops.pa@Xerox.COM
- Subject: Two questions and two comments
- From: macgreg@vaxa.isi.edu
- Date: Thu, 02 Jul 87 15:53:06 PDT
- Cc: macgreg@vaxa.isi.edu
- Posted-date: Thu, 02 Jul 87 15:53:06 PDT
Sometimes I find myself holding onto a class object and wanting to know
the value of one of its class variables. Does/will CLOS provide a way
to access class variables other than via class instances (sometimes I
haven't yet allocated any instances when I need the value)?
Comment: For the sake of uniformity, I would vote that initforms of
class variables be evaluated just as they are for instance variables --
I get temporarily tripped-up every so often by the inconsistency in the
syntax.
Second question: The "add-named-class" function allows us to create a
class "on-the-fly" without having to use "eval". Is there a similar
construct for creating methods at run time (i.e., will it be
advertised)? PCL obviously has such a function, since methods can be
created as a side-effect of calling "add-named-class". By the way,
is "add-name-class" part of CLOS, or just a PCL feature?
Suggestion: I did some timings on compiled segments of CLOS code (on a
Symbolics), and found that a slot access is 20 times faster if a
"with-slots" is declared with :use-accessors = nil than if the slot is
accessed with the ordinary syntax (and its 30 times faster than a
"slot-value" form). So, there is great incentive to place "with-slots"
declarations everywhere. I've invented a "let-slots" macro which
expands to a "let" statement with a "with-slots" inside of it, which
looks much more attractive than having to declare both statements. My
suggestion is to put something equivalent to "let-slots" into CLOS.