Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!emory!att!pacbell.com!pacbell!osc!jgk From: jgk@osc.COM (Joe Keane) Newsgroups: comp.lang.lisp Subject: Re: Problems Copying Structures Summary: Object-oriented doesn't solve deep copying. Keywords: defstruct structures copying Message-ID: <4083@osc.COM> Date: 13 Dec 90 20:36:50 GMT References: <1990Dec8.071142.5318@cec1.wustl.edu> <1990Dec8.180825.21702@Think.COM> <93985@aerospace.AERO.ORG> Reply-To: jgk@osc.COM (Joe Keane) Organization: Versant Object Technology, Menlo Park, CA Lines: 21 In article <1990Dec8.180825.21702@Think.COM> barmar@think.com (Barry Margolin) writes: >Structure copiers are only supposed to copy the structure itself, not the >objects referenced by the structure. They are like COPY-LIST rather than >COPY-TREE. If you want more, you have to write your own copier function >that does precisely what you want. There's no standard function that's >able to read the programmer's mind and determine which parts of a structure >should be copied and which should just be referenced. >Note that this [structure copier] still only copies one level more >than the automatically-generated copier. If you also want to copy >the objects referenced in the arrays you'll have to do more. In article <93985@aerospace.AERO.ORG> srt@aerospace.aero.org (Scott "TCB" Turner) writes: >One of the better arguments for object-oriented programming. I don't see what object-oriented programming has to do with this. The same problems with deep vs. shallow copying come up, and there's no magic solution which always does what you want. One thing i do know is that it's a hell of a lot easier to automatically generate functions you want in Lisp than in C++.