Skip to content
Tcl Source Code View Ticket
Login

View Ticket

kbk's cloning problem

Closed / Fixed1863642fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2008-01-03 23:14:05
(Open issue: There is a use case for making objects unclonable; consider the case where the metadata consists of one or more OS resource handles. Simply shallow-copying resource handles is a bad idea, but deep-copying them may well be infeasible. Not all objects can handle copy-on-write semantics gracefully.)
dkfplain2008-01-06 06:09:00
Logged In: YES 
user_id=79902
Originator: YES

Needs an API change; current API not sophisticated enough.
kennykbplain2008-01-06 07:08:40
Logged In: YES 
user_id=99768
Originator: NO

Very little additional sophistication should be needed:

NULL cloneProc => object is not clonable
cloneProc returns NULL => given metadata should be removed
cloneProc returns the clientData that it's given => do nothing
    with that type of metadata when cloning
cloneProc returns anything else => replace the clientData when
    cloning.

We could even Stubs-export an identity procedure on ClientData
so that a metadata type could just put Tcl_ShallowCopy in the
cloneProc slot.
dkfplain2008-01-06 22:11:12
Logged In: YES 
user_id=79902
Originator: YES

All fixed now. Note that this has changed the API.
Log in (anonymous is fine) to add a comment.