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

Re: insert classes?



In Rainy Day PCL, the following function should do what you want:

(defun insert-class (class below above)
  (flet ((get-class (n)
           (if (pcl::classp n) n (find-class n))))
    (let ((c (get-class class))
	  (b (get-class below))
	  (a (get-class above)))
      (reinitialize-instance c :direct-superclasses (list b))
      (reinitialize-instance a :direct-superclasses (subst c b (class-direct-superclasses a))))))

if you had

(defclass foo () ())
(defclass baz (foo some-other-class) ())

and you wanted to stick bar in between baz and foo, you could say:

(defclass bar () ())

(insert-class 'bar 'foo 'baz)
-------