X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=blobdiff_plain;f=attrib-class.lisp;h=b102eca9300d33edb1e92ac8ce42dfc507b50cd6;hp=378bae0f6fb832cfde0376b0985d81b331287aa5;hb=373a64e9369c2e96c465eb462a035884c7e08fa6;hpb=f6555d4ded6e1612ef1042fdbfd8df3c8eb5df18 diff --git a/attrib-class.lisp b/attrib-class.lisp index 378bae0..b102eca 100644 --- a/attrib-class.lisp +++ b/attrib-class.lisp @@ -16,6 +16,10 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* +;; Disable attrib class until understand changes in sbcl/cmucl +;; using COMPUTE-SLOT-ACCESSOR-INFO and defining method +;; for slot access of ALL-ATTRIBUTES. Does this work on Allegro/LW? + ;;;; Defines a metaclass that allows the use of attributes (or subslots) ;;;; on slots. Based on example in AMOP, but modified to use ACL's MOP. @@ -28,18 +32,18 @@ on example from AMOP")) (defclass attributes-dsd (kmr-mop:standard-direct-slot-definition) ((attributes :initarg :attributes :initform nil - :accessor dsd-attributes))) + :accessor dsd-attributes))) (defclass attributes-esd (kmr-mop:standard-effective-slot-definition) - ((attributes :initarg :attributes :initform nil - :accessor esd-attributes))) + ((attributes :initarg :attributes :initform nil + :accessor esd-attributes))) ;; encapsulating macro for Lispworks (kmr-mop:process-slot-option attributes-class :attributes) #+(or cmu scl sbcl openmcl) (defmethod kmr-mop:validate-superclass ((class attributes-class) - (superclass kmr-mop:standard-class)) + (superclass kmr-mop:standard-class)) t) (defmethod kmr-mop:direct-slot-definition-class ((cl attributes-class) #+kmr-normal-dsdc &rest initargs) @@ -61,24 +65,24 @@ on example from AMOP")) (defmethod kmr-mop:compute-slots ((class attributes-class)) (let* ((normal-slots (call-next-method)) - (alist (mapcar - #'(lambda (slot) - (cons (kmr-mop:slot-definition-name slot) - (mapcar #'(lambda (attr) (list attr)) - (esd-attributes slot)))) - normal-slots))) + (alist (mapcar + #'(lambda (slot) + (cons (kmr-mop:slot-definition-name slot) + (mapcar #'(lambda (attr) (list attr)) + (esd-attributes slot)))) + normal-slots))) (cons (make-instance - 'attributes-esd - :name 'all-attributes - :initform `',alist - :initfunction #'(lambda () alist) - :allocation :instance - :documentation "Attribute bucket" - :type t - ) - normal-slots))) - + 'attributes-esd + :name 'all-attributes + :initform `',alist + :initfunction #'(lambda () alist) + :allocation :instance + :documentation "Attribute bucket" + :type t + ) + normal-slots))) + (defun slot-attribute (instance slot-name attribute) (cdr (slot-attribute-bucket instance slot-name attribute))) @@ -88,14 +92,14 @@ on example from AMOP")) (defun slot-attribute-bucket (instance slot-name attribute) (let* ((all-buckets (slot-value instance 'all-attributes)) - (slot-bucket (assoc slot-name all-buckets))) + (slot-bucket (assoc slot-name all-buckets))) (unless slot-bucket (error "The slot named ~S of ~S has no attributes." - slot-name instance)) + slot-name instance)) (let ((attr-bucket (assoc attribute (cdr slot-bucket)))) (unless attr-bucket - (error "The slot named ~S of ~S has no attributes named ~S." - slot-name instance attribute)) + (error "The slot named ~S of ~S has no attributes named ~S." + slot-name instance attribute)) attr-bucket)))