Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3b56eeec7416461a05077187313cdee599bd7052
Ticket: dd3b844fdabdeae5fcb07f4a16d1c62ae5fa75ac
oo::copy needs an optional namespace parameter
User & Date: dkf on 2016-11-23 21:42:28
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    <h2>Background</h2>
    I was talking to Nathan Coulter at the Tcl conference and he was telling me about some of the things that are done in Rivet and NaviServer to get speed. In particular, he was doing horrible things to try to clone a namespace; it was a significant bottleneck. I mentioned that TclOO can clone namespaces (imperfectly) and speculated that <tt>oo::copy</tt> might be a useful tool. And indeed it might, except that existing code requires that the created namespace have a particular name (<tt>::request</tt> if I remember right) and <tt>oo::copy</tt> doesn't allow specifying the name of the created namespace, even though the underlying C API for object copying (<tt>Tcl_CopyObjectInstance</tt>) does.
    <h2>Feature Request</h2>
    Add an extra optional argument to <tt>oo::copy</tt> to allow specifying the target object namespace. If omitted, the current behaviour should be used. If present, it must be in a form acceptable to <tt>Tcl_CreateNamespace</tt> and <i>must not refer to an existing namespace</i>; the name of the clone object's namespace will be the given value (instead of the default, arbitrary one). This will make <tt>oo::copy</tt> have two optional arguments, instead of the current single one.
    <dl><dd><tt><b>oo::copy</b> <i>sourceObject</i> ?<i>targetObject</i>? ?<i>targetNamespace</i>?</tt></dd></dl>
    <h2>Implementation Notes</h2>
    The basic functionality is already there at the C level; this is just exposing it to the Tcl level (and testing/documenting).
    
  5. is_private changed to: "0"
  6. login: "dkf"
  7. priority changed to: "5 Medium"
  8. resolution changed to: "None"
  9. severity changed to: "Minor"
  10. status changed to: "Open"
  11. submitter changed to: "dkf"
  12. subsystem changed to: "35. TclOO Package"
  13. title changed to: "oo::copy needs an optional namespace parameter"
  14. type changed to: "RFE"