I have been attempting to port some Allegro CL code that uses CLOS
heavily, to CMUCL/PCL.
I just ran into a somewhat puzzling bug. I have compiled a file
containing a class definition and the definition of an
INITIALIZE-INSTANCE :AFTER method for the class in question. The file
compiles with no errors, but I get an error when LOADING the resulting
compiled code:
Here's the error:
No matching method for the generic-function #<Standard-Generic-Function
PCL::CLASS-WRAPPER (1) {281F60E9}>,
when called with arguments (NIL).
I've looked at the backtrace and the problem happens inside
fast-init.lisp, specifically the function PCL::reset-initialize-info,
which calls pcl::class-wrapper:
(defun reset-initialize-info (info)
(setf (initialize-info-wrapper info)
(class-wrapper (car (initialize-info-key info))))
(let ((slots-to-revert (if *revert-initialize-info-p*
(initialize-info-bound-slots info)
'(make-instance-function))))
(reset-initialize-info-internal info)
(dolist (slot slots-to-revert)
(update-initialize-info-internal info slot))
info))
When I look at the INFO object, looks like something pretty bad's going on:
1] (describe (debug:var 'pcl::info))
#S(PCL::INITIALIZE-INFO
:KEY NIL
:WRAPPER NIL
:CACHED-VALID-P :UNKNOWN
:CACHED-RI-VALID-P :UNKNOWN
:CACHED-INITARGS-FORM-LIST :UNKNOWN
...) is a structure of type INITIALIZE-INFO.
KEY: NIL.
WRAPPER: NIL.
CACHED-VALID-P: :UNKNOWN.
CACHED-RI-VALID-P: :UNKNOWN.
CACHED-INITARGS-FORM-LIST: :UNKNOWN.
CACHED-NEW-KEYS: :UNKNOWN.
CACHED-DEFAULT-INITARGS-FUNCTION: :UNKNOWN.
CACHED-SHARED-INITIALIZE-T-FUNCTION: :UNKNOWN.
CACHED-SHARED-INITIALIZE-NIL-FUNCTION: :UNKNOWN.
CACHED-CONSTANTS: :UNKNOWN.
CACHED-COMBINED-INITIALIZE-FUNCTION: :UNKNOWN.
CACHED-MAKE-INSTANCE-FUNCTION: :UNKNOWN.
CACHED-MAKE-INSTANCE-FUNCTION-SYMBOL: :UNKNOWN.
The code that generated this problem is the following:
(defclass bt-object ()
()
(:documentation "These are objects whose creation
should be undone on backtracking. By and large, it seems that anything
that's
a BT-OBJECT should also be a NAMED-OBJECT (qv.). If you have an object
that's
only one of these two, you may have an incipient bug.")
)
(defmethod initialize-instance :after ((instance bt-object) &key)
"When you create a BT-object, make sure you remember that on the
BT stack."
(BT-push instance)
)
Any suggestions?
Thanks,
R