[armedbear-devel] Unbound initargs slot in slot-definitions
Stas Boukarev
stassats at gmail.com
Mon Aug 13 20:43:55 UTC 2012
Having two classes:
(defclass slot-d-1 (mop:standard-direct-slot-definition)
())
(defclass slot-d-2 (mop:standard-direct-slot-definition)
(a))
(slot-boundp (make-instance 'slot-d-2) 'sys::initargs)
=> T
(slot-boundp (make-instance 'slot-d-2) 'sys::initargs)
=> NIL
So, having a slot makes initargs unbound.
Below is the actual code which suffers from it:
(defpackage test
(:use :cl :mop))
(in-package test)
(defclass storable-class (standard-class)
())
(defmethod validate-superclass
((class standard-class) (superclass storable-class))
t)
(defmethod validate-superclass
((class storable-class) (superclass standard-class))
t)
(defclass storable-direct-slot-definition (standard-direct-slot-definition)
((storep :initarg :storep
:initform t
:reader store-slot-p)))
(defmethod direct-slot-definition-class ((class storable-class) &key)
(find-class 'storable-direct-slot-definition))
;;;
(defclass identifiable ()
((id :accessor id
:initform nil
:storep nil))
(:metaclass storable-class))
The last form receives an error:
The slot INITARGS is unbound in the object
#<STORABLE-DIRECT-SLOT-DEFINITION {34C1EFE7}>.
--
With best regards, Stas.
More information about the armedbear-devel
mailing list