Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!news.duke.edu!eff!usenet.ins.cwru.edu!agate!sunsite.doc.ic.ac.uk!lyra.csx.cam.ac.uk!pipex!demon!aclark.demon.co.uk!asc
From: Alexander Clark <asc@aclark.demon.co.uk>
Subject: Re: Copying CLOS instance?
Message-ID: <CyuuyA.CF0@demon.co.uk>
X-Xxmessage-Id: <AAE2BAAE660108BE@aclark.demon.co.uk>
X-Xxdate: Sun, 6 Nov 1994 16:54:06 GMT
Sender: news@demon.co.uk (Usenet Administration)
Nntp-Posting-Host: aclark.demon.co.uk
Organization: None
X-Newsreader: Nuntius Version 1.2
References: <3998p8$es5@Times.Stanford.EDU>
Date: Sun, 6 Nov 1994 16:54:09 GMT
Lines: 22

In article <3998p8$es5@Times.Stanford.EDU> Don Geddis, geddis@CS.Stanford.EDU writes:
> If you have a defstruct class, and then an object that's an instance of it,
> you get for free a "copy-<class>" function to make a copy of the instance.
> I want to do the same thing with a CLOS instance, but sadly there appears to
> be no corresponding copy function.  I would guess that somehow using the
> Meta Object Protocol I'd be able to write such a copy function, but the MOP
> is well beyond my current understanding.  Does anyone know a simple way to
> do this?
> 
> (And yes, I know that I could make a new instance of the class and copy the
> slots over one by one; what I'm looking for is a function that, even if I
> later change the definition of the class, still manages to copy an instance
> successfully.)
> 
> 	-- Don

In MCL 2.0 you have 'copy-instance', which is the obvious function, 
that just copies the vector used to store the instance slots, ie a shallow copy.
---------------------------
Alexander Clark
asc@aclark.demon.co.uk
---------------------------
