[metacopy-devel] Structure sharing and unbound slots
Jan Moringen
jan.moringen at uni-bielefeld.de
Wed Oct 13 18:07:44 UTC 2010
Hi,
thanks for metacopy, it's very useful.
I have a small problem and associated suggestion to make, though.
Currently the "duplicate-set" behavior actually has two behaviors (I'm
not completely sure about the first one):
* setting the slot value in the copied object to the result of
evaluating an arbitrary form
* setting the slot value in the copied object to the slot value in
the original object such that they are `eq' and therefore share
structure
When used in the second mode, there is no check to make sure the slot is
bound in the original object. Currently, this makes it impossible to
have "safe" copying of slots without invoking the deep copy machinery.
My suggestion is to separate the "duplicate-set" behavior into
* a modified "duplicate-set" behavior (keyword :set) that does not
access slots in the original object, but assigns the result of
evaluating a form
* a new "duplicate-share" behavior (keyword :share) that does a
"safe" (nop if unbound) structure sharing assignment
The attached patch roughly implements the suggestion.
What do you think?
Kind regards,
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: metacopy-add-share-duplicator.diff
Type: text/x-patch
Size: 4604 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/metacopy-devel/attachments/20101013/b5855115/attachment.bin>
More information about the metacopy-devel
mailing list