Open Ambrevar opened 2 years ago
I'll think about this. I don't want to take on the bigger issue of what it means to "copy" something (see Pitman's essay on the subject), but I could see a place for a shallow copy-object
function that works for CLOS objects the same way copy-structure
works for structs.
I might be missing an existing implementation of
copy-object
, but I find it useful sometimes.Shallow copy:
make-instance
call so thatinitialize-instance :after
has the slots set the right values already. Without this requirement, we could first call make-instance without initializing any slot and then loop over the slots, which has the benefit of not relying on a guess of the initargs. The downside is that some classes require slot values atmake-instance
time.slot-value
withcopy-object
so that it copies the slots recursively.Thoughts?