Hi, Thanks for your response.
[email protected] writes: > Quoth the docs > > " -- generic: deep-clone > -- method: deep-clone (self <object>) > Return a “deep” clone of SELF. The default method makes a deep > clone by allocating a new instance and copying or cloning slot > values from self to the new instance. If a slot value is an > instance (satisfies ‘instance?’), it is cloned by calling > ‘deep-clone’ on that value. Other slot values are copied either as > immediate values or by reference." > > Now a list isn't an object instance (i.e. it says #f to instance?). > You'll either have to override your clone method to be more savvy > or do something similar. My reading of this was that a new instance is allocated and, since the default #:allocation slot option is '#:instance', GOOPS "creates separate storage for this slot in each new instance of the containing class (and its subclasses)." So I assumed that new storage is allocated for the slot and the data is copied over, which meant that the whole list was copied. I guess the key words "by reference" carried more weight than I mentally allocated to them. GOOPS created separate storage for a new pointer, not a whole list, and the only the address of the list was copied into this pointer. Tricky, but it makes sense I guess. In my case, I can simply get rid of the deep-clones and instead create a fresh instance and manually copy some of the slots from the old instance. Laziness and programmers are dangerous bedfellows. Cheers, -- -brandon
