Lisp HUG Maillist Archive

MOP Bug

Hi,

In my work on providing a MOP compatibility package - see 
http://common-lisp.net/project/closer/ - I have encountered the 
following bug in LispWorks (4.3 personal edition): In some cases, 
remove-direct-subclasses is not called when a class changes its direct 
superclasses. Here is an example:

(use-package :clos)

(defclass test-class (standard-class)
   ())

(defmethod validate-superclass
            ((class test-class)
             (superclass standard-class))
   t)

(defmethod remove-direct-subclass :after
   ((superclass test-class) (subclass test-class))
   (format t "Direct subclass ~S removed from ~S.~%"
           subclass superclass))

(defclass test-super () ()
   (:metaclass test-class))

(defclass test-sub1 (test-super) ()
   (:metaclass test-class))

(defclass test-sub2 (test-super) ()
   (:metaclass test-class))

(defclass test-sub1 () ()
   (:metaclass test-class))

(reinitialize-instance
  (find-class 'test-sub2)
  :direct-superclasses (list (find-class 'standard-object)))

This code results in the desired output for test-sub1 but not for 
test-sub2.


Cheers,
Pascal

--
But do not try and hide the parens. That's impossible. Instead only
try to realize the truth. There are no parens. - Tayssir John Gabbour


Updated at: 2020-12-10 08:53 UTC