[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: insert classes?
- To: Petra Sommer <petra@cs.uni-sb.de>
- Subject: Re: insert classes?
- From: Gregor.pa@Xerox.COM
- Date: Tue, 20 Mar 90 14:57 PST
- Cc: CommonLoops.PA@Xerox.COM
- Fcc: BD:>Gregor>mail>outgoing-mail-9.text.newest
- In-reply-to: <9003201422.AA12655@fb14vax.cs.uni-sb.de>
- Line-fold: no
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)
-------