[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch for slot-value



The option "default" in slot-value-using-class doesn't work:

(slot-value-using-class class object slot-name dont-call-slot-missing-p 
                                       default)
         ==>
...
(slot-value-using-class--class class object ... default)

         ==>
...
(slot-value-using-class--class-internal ,class ,object .. ,default)

         ==>

Now slot-value-using-class--class-internal never passes "default"
to "with-slot-internal", and if it would pass it "with-slot-internal"
would not return it.

Here is our patch:

(defun slot-value-using-class--class-internal (class object slot-name
                                               dont-call-slot-missing-p
                                               default)
  (with-slot-internal--class (class object slot-name nil)
    (:instance ...)
    (:dynamic ...)
    (:class ...)
    (nil () (progn 
              (unless dont-call-slot-missing-p
                      (slot-missing object slot-name))
              default))))

(defmacro with-slot-internal--class ((class object slot-name createp) 
                                      &body cases)
  ....

  nil-case
    (let ,(and (car nil-case) '((,(caar nil-case) ,temp1)))
                            ;;^ backquote
         (return . ,(cdr nil-case))))))


Now slot-exists-p also works.

---------------

Something else:

We need to redefine classes that have been created with a certain
metaclass with an other metaclass. This is not possible in the
current version of PCL. There should be a (when new-metaclass-p ... 
with (class-change old-class new-metaclass) in "update-class".

(defclass a ()
  (s1)
  (:metaclass standard-class))

(defclass my-meta-class (standard-class)
  (...))

(defclass a ()
  (s1)
  (:metaclass standard-class))

                            Angela
                            adf%ztivax.siemens.com@siemens.com