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


I use the st-patricks-day version of PCL. There are some bugs and I don't
know whether they still are in the latest version. I report them anyway.

1. In update-slot-accessors--class in std-class.lisp
you do a separate update for instance and non-instance classes. This leads
to inconsistent behavior if you redefine an accessor and the allocation of
the slot at the same time.
 e.g. (defclass foo ()
        ((s1 :allocation :class :accessor foo-s1)))
      (defclass foo ()
        ((s1 :allocation :instance :accessor s1)))

(setq i-foo (make-instance 'foo :s1 1))
(s1 i-foo)  ;-> 1
(foo-s1 i-foo) ; ->1; foo-s1 should not be known anymore

whereas the following is correct:
      (defclass foo ()
        ((s1 :allocation :class :accessor foo-s1)))
      (defclass foo ()
        ((s1 :allocation :instance :accessor foo-s1)))
      (defclass foo ()
        ((s1 :allocation :instance :accessor s1)))

(setq i-foo (make-instance 'foo :s1 1))
(s1 i-foo)  ;1
(foo-s1 i-foo)  ; error

2. In braid1 there is the constant definition for
class-instance-slots-position. It is used in the functions
class-instance-slots and setf-class-instance-slots. They again are used in
class definition. The problem arises when you define your own metaclass that
has multiple supers, one of which is standard-class.

(defclass my-standard-class (standard-class an-other-class) ())

my-standard-class inherits slots from all superclasses. They get rearranged
but class-instance-slots / setf-class-instance-slots still access the slot
in the old class-instance-slots-position. This causes errors. 

The same should be true in the similar case with slotd-name.

(A minor thing: the slots that are inherited from the superclasses are in
the order 'right-most class first' whereas I would expect it the other way
around. This is not the problem but it unveiled it.)

3. A thing that I mentioned earlier but probably wasn't understandable as
there was a typo: If you redefine classes with a new metaclass the redefined
class will still be of the old metaclass and not know it's new behavior.

  (defclass bar () (..) )
  (defclass my-meta-class (standard-class) (...))
  (defclass bar () (..) (:metaclass my-meta-class))

bar will still be of metaclass standard-class.

There must be an
  (when new-metaclass-p
    (class-change class new-meta-class))
in update-class.