Subject: Re: copy construction in CLOS
From: Erik Naggum <>
Date: 1999/02/13
Newsgroups: comp.lang.lisp
Message-ID: <>

* (Daniel J. Yoder)
| Another newbie question.  I am a little confused by the lack of any
| explicit notion in CLOS for copying an object.

  there is no such thing as a copy of an object.  let me clarify before you
  object.  let's define a copy of an original object to be an object equal
  to the original in all respects save that if you alter the copy, you do
  not also alter the original.  that seems to imply deep copy, but I think
  it means shallow copy.

  now, since "copy" is defined in terms of the possible alterations, it
  should be intuitively evident that there is a _purpose_ to a copy that
  needs to be communicated.  e.g., when I want a copy of a _list_, I want a
  fresh cdr chain that I can modify, but I do _not_ thereby want copies of
  all the elements of the list.  Common Lisp offers COPY-LIST to copy the
  cdr chain, COPY-ALIST to copy the cdr chain and any cons cells that are
  members of the list, and COPY-TREE to copy all cons cells.  this is
  pretty specific, don't you think?  try to communicate this to a generic
  copy for lists.

  and, since "copy" is defined in terms of "equal", which does not include
  the object identity at some level or another, and possibly any number of
  other properties, all the problems of a generic EQUAL apply with full
  force.  you'll note that there is no EQUAL for class instances, either.

  I yield the floor to Kent Pitman on EQUAL.  :)

  Y2K conversion simplified: Januark, Februark, March, April, Mak, June,
  Julk, August, September, October, November, December.