Version 4 of oo::copy

Updated 2014-03-01 14:52:09 by pooryorick

oo::copy , a built-in Tcl command, creates a duplicate of a TclOO object.

Documentation

official reference

Synopsis

oo::copy sourceObject ?targetObject?

Description

oo::copy duplicates structure of an object and then calls an internal method of the created object, <cloned>, with the source object as an argument, which sets up any advanced properties of the created object based on the source object . The default implementation of that method in the oo::object class copies procedures and variables from the source object's namespace, but does not copy any traces or commands implemented in C.

Objects can potentially refuse to be duplicated, generating an error instead. Generating an error from the <cloned> method counts as refusal.