From: Software Scavenger
Subject: defconstructor, make-instance, etc.
Date: 
Message-ID: <a6789134.0202011958.40b02963@posting.google.com>
In a recent thread about make-instance, someone mentioned
defconstructor, but I couldn't find it in the Hyperspec.  Is it
implementation specific?  Do the major commercial implementations have
various ways to make instances of CLOS objects?  For example, given an
existing CLOS object, is there a fast function to make a copy of it? 
Would such a function just have to do a binary copy, or would it have
to update some information which keeps track of CLOS objects in
various ways and isn't directly a part of each object?

From: Kent M Pitman
Subject: Re: defconstructor, make-instance, etc.
Date: 
Message-ID: <sfwpu3n61dq.fsf@shell01.TheWorld.com>
··········@mailandnews.com (Software Scavenger) writes:

> ... given an existing CLOS object, is there a fast function to
> make a copy of it? ...

To understand why this question is ill-formed, read:

  http://world.std.com/~pitman/PS/EQUAL.html
From: Marc Spitzer
Subject: Re: defconstructor, make-instance, etc.
Date: 
Message-ID: <slrna5otm5.m7.marc@oscar.eng.cv.net>
In article <···············@shell01.TheWorld.com>, Kent M Pitman wrote:
> ··········@mailandnews.com (Software Scavenger) writes:
> 
>> ... given an existing CLOS object, is there a fast function to
>> make a copy of it? ...
> 
> To understand why this question is ill-formed, read:
> 
>   http://world.std.com/~pitman/PS/EQUAL.html

Welcome back.

marc
From: Software Scavenger
Subject: Re: defconstructor, make-instance, etc.
Date: 
Message-ID: <a6789134.0202030536.42f12a8c@posting.google.com>
Kent M Pitman <······@world.std.com> wrote in message news:<···············@shell01.TheWorld.com>...
> ··········@mailandnews.com (Software Scavenger) writes:
> 
> > ... given an existing CLOS object, is there a fast function to
> > make a copy of it? ...
> 
> To understand why this question is ill-formed, read:
> 
>   http://world.std.com/~pitman/PS/EQUAL.html


Sorry, I didn't think about what I was asking.  What I meant was to
make each slot eq the corresponding slot of the original object.  This
is after the object has been constructed but before it has any
interesting data in it.  All of its slots are eq the corresponding
slots of other newly constructed objects of the same class.  Is there
any faster way to do such a copy operation than to allocate-instance
and copy each slot?
From: Steven M. Haflich
Subject: Re: defconstructor, make-instance, etc.
Date: 
Message-ID: <3C5FF1C5.24B30F02@pacbell.net>
Software Scavenger wrote:

> Sorry, I didn't think about what I was asking.  What I meant was to
> make each slot eq the corresponding slot of the original object.  This
> is after the object has been constructed but before it has any
> interesting data in it.  All of its slots are eq the corresponding
> slots of other newly constructed objects of the same class.  Is there
> any faster way to do such a copy operation than to allocate-instance
> and copy each slot?

No, there is no generic builtin way to do this, and there are very
good reasons why not.

Abstractly, the creation of instances is under control of the
implementation of the class -- that's what metaclasses are all about.
suppose you defined a class for which "equivalent" objects are interned
in some way so that noly a single "equivalent" object may exist --
pathnames are one historical example in certain systems.  Or consider
a class where each instance receives a unique sequence number
dentifier.  There are even some classes where only a single instance is
allowed to exist.  The ability to "copy" such an instance without
intervention of the class' implementation could violate other assumptions
in the implementation of that class.

All this is closely tied to the notion of equivalence, which is why it
was appropriate for Kent to point you at his equality paper.

==========

Experience has shown the Common Lisp community to be relatively
apolitical, in the same way that a pack of rabid dogs is apolitical.

Steve Haflich
From: Software Scavenger
Subject: Re: defconstructor, make-instance, etc.
Date: 
Message-ID: <a6789134.0202051106.14d8cdda@posting.google.com>
"Steven M. Haflich" <·······@pacbell.net> wrote in message news:<·················@pacbell.net>...

> Abstractly, the creation of instances is under control of the
> implementation of the class -- that's what metaclasses are all about.

And that's under control of the person who creates the class.  And
that's me.  I'm the one who wants to make millions of copies of an
object which is an instance of one of my classes.  All I'm asking is
for a fast way to do that.  Ok, so I should add this fast copy feature
to my class, and make sure my class is responsible for it.  Fine, but
first I have to know how to do it.  All I know now is
allocate-instance and copy each slot.  How fast should
allocate-instance be?  Does it do anything other than allocate the
memory for the object?  For some reason it seems slow when I try to
measure it.