[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
slot-unbound
- To: info-mcl@cambridge.apple.com
- Subject: slot-unbound
- From: Sheldon S. Ball <ssb@fiona.umsmed.edu>
- Date: Thu, 2 Jun 94 12:35:54 -0500
I was attempting to define methods for the generic function
slot-unbound in different packages for different classes of
objects. MCL 2.0.1 seems only to recognize the method defined
on STANDARD-OBJECT. Am I overlooking something?
Thanks, Sheldon
(in-package :user)
(defpackage small-package (:use "COMMON-LISP"))
(defmethod slot-unbound ((class STANDARD-OBJECT) instance slot-name)
(declare (ignore slot-name))
(declare (ignore instance))
'unbound)
(in-package :small-package)
(defclass small-object ()
((slot-1 :initarg :slot-1 :accessor slot-1)
(slot-2 :initarg :slot-2 :accessor slot-2)))
(defmethod slot-unbound ((class small-object) instance slot-name)
(declare (ignore slot-name))
(declare (ignore instance))
'unbound)
;;Check value of unbound slot
(slot-1 (make-instance 'small-object))
;;==> UNBOUND
(eq (slot-1 (make-instance 'small-object)) 'user::unbound)
;;==> T
(eq (slot-1 (make-instance 'small-object)) 'small-package::unbound)
;;==> NIL
;;END