[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
:initform and :allocation :class
- To: CommonLoops.pa@Xerox.COM
- Subject: :initform and :allocation :class
- From: Richard L. Piazza <rich%linus@mitre-bedford.ARPA>
- Date: Tue, 19 Apr 88 18:17:55 EDT
- Posted-date: Tue, 19 Apr 88 18:17:55 EDT
- Posted-from: The MITRE Corp., Bedford, MA
- Redistributed: CommonLoops.pa
We've run into the following problems when using the St.
Patrick's Day release of PCL: (Symbolics)
1) Compiling or evaluating the form,
(defclass foo () ((bar :initform 'bar :allocation :class)))
creates a class whose "bar" slot is initialized to "'bar", rather than
"bar" as the CLOS specification dictates. Further, if the quote is
left off of the argument to :initform, the compiler complains that "bar
is unknown and has been declared special" but creates a class that
behaves as if the argument was not evaluated (which turns out
to be a problem in the initfunction that is created by
The documentation indicates that an :initform that is allocated at
the class should be EVALUATED at evaluation/compile time. This does
not take place, leading to the behavior mentioned above.
We have thought of the following fix to parse-class-slot:
(defmethod PARSE-CLASS-SLOT ((class standard-class) slot)
:keyword (make-keyword name)
:initform (IF (EQ ALLOCATION :CLASS)
The change is highlighted in caps.
Has anyone come across this error and come up with a better fix?
2) subtypep doesn't work on classes. For instance:
(defclass foo () (x y z))
(defclass goo (foo) (blah blaz blub))
(subtypep 'foo 'goo) => nil nil