[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Copying a CLOS Instance
- To: info-macl@cambridge.apple.com
- Subject: Copying a CLOS Instance
- From: "Shetti Dattatraya" <Shetti_Dattatraya@ssdc.honeywell.com>
- Date: 24 Jun 91 11:21:06 U
- Priority: Normal
- Return-receipt-to: Shetti_Dattatraya@ssdc.honeywell.com
Given an instance is there a CLOS method to copy it?
In the XEROX release of PCL we had following cludge..
(defmethod COPY-INSTANCE ((obj T))
(let ((new (pcl::make-instance (class-name (class-of obj))))
(islots (pcl::wrapper-instance-slots-layout
(pcl::class-wrapper (class-of obj)))))
(dolist (slot islots)
(when (slot-boundp obj slot)
(setf (slot-value new slot)
(slot-value obj slot))))
new))
With the native implementation of CLOS (without metaclass fascility)in
the Allegro2.0b1 Common Lisp, such a hack will not work.
-Dattatraya Shetti
Mail address: shetti@ssdc.honeywell.com