[Openmcl-devel] OpenMCL MOP Reports

Kevin Rosenberg kevin at rosenberg.net
Wed Jun 25 01:21:32 UTC 2003

Gary Byers wrote:
> The fix is in CVS (and asdf compiles and loads with the fix in place.)
> Thanks.

Wow, fast fix!

I've attached a test file which illustrates a few things with the MOP.

The first is fairly simple. The signatures of
direct-slot-definition-class and effective-slot-definition-class does
not match the signature in AMOP. Similarly, the signature in
compute-effect-slot-defintion also does not match AMOP.

The less trivial issue is that the (defclass a ...) reports:
Illegal option :ATTRIBUTES

Thanks for adding the MOP to OpenMCL!

Kevin Rosenberg
kevin at rosenberg.net

-------------- next part --------------
;; Works fine on allegro 6.2, cmucl 18e+, sbcl 0.8.0

(defpackage #:tmop
  (:use #:cl
	#+openmcl #:openmcl-mop
	#+sbcl #:sb-mop
	#+cmu #:mop
	#+allegro #:mop))
(in-package #:tmop)

(defclass attributes-dsd (standard-direct-slot-definition)
  ((attributes :initarg :attributes :initform nil
	       :accessor dsd-attributes)))

(defclass attributes-esd (standard-effective-slot-definition)
  ((attributes :initarg :attributes :initform nil 
	       :accessor esd-attributes)))

(defclass tclass (standard-class)

#+(or cmu scl sbcl)
(defmethod validate-superclass ((class tclass)
				(superclass standard-class))

(defmethod direct-slot-definition-class ((cl tclass) #-openmcl &rest initargs)
  (declare (ignore initargs))
  (find-class 'attributes-dsd))

(defmethod effective-slot-definition-class ((cl tclass) #-openmcl &rest initargs)
  (declare (ignore initargs))
  (find-class 'attributes-esd))

(defmethod compute-effective-slot-definition :around ((cl tclass) #-openmcl name
  (declare (ignore name))
  (let ((esd (call-next-method)))
    (setf (esd-attributes esd) (dsd-attributes (car dsds)))

(defclass a ()
   (b :attributes t))
  (:metaclass tclass))

(defparameter *a* (make-instance 'a))

(dolist (s (class-slots (class-of *a*)))
  (format t "~&slot ~A attributes: ~A~%" (slot-definition-name s)
	  (esd-attributes s)))

-------------- next part --------------
Openmcl-devel mailing list
Openmcl-devel at clozure.com

More information about the Openmcl-devel mailing list