Subject: Re: Importing slot values from an existing object
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 09 Aug 2006 05:09:54 -0500
Newsgroups: comp.lang.lisp
Message-ID: <i_6dndjJIszvKUTZnZ2dnUVZ_rWdnZ2d@speakeasy.net>
Chaitanya <icehotcg@gmail.com> wrote:
+---------------
| Ken Tilton wrote:
| > Sounds even fishier. What would the names of the two classes be?
| 
| There's more than two classes. I have one base class, and a few
| subclasses with specialized methods for them. I want to preserve the
| original object so I can export its slots to instances of different
| subclasses.
+---------------

Is there only one such "original object"? Are the values of its
slots essentially read-only? If so, have you looked into using
the (:ALLOCATION :CLASS) slot option when defining A? Then all
instances of A, *including* all instances of B, will share the
same slots. [Well, for those slots of A for which you specify
(:ALLOCATION :CLASS)...]

If not, then maybe what you really want is not CLOS but a
prototype-based object system such as provided by, say, KR
(available as a part of the Garnet distribution or now by
itself, see <http://www.cliki.net/KR>).


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607