Skip to content
Tcl Source Code History Of Ticket c9ca7bca7e
Login

History Of Ticket c9ca7bca7e

Artifacts Associated With Ticket c9ca7bca7e

  1. Ticket change [6009146fa7] (rid 148809) by anonymous on 2016-09-18 00:17:44:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/html"
    4. comment initialized to:
      In Tcl, there is no possibility to import proc's from other namespaces with other names to avoid collisions. For example, something like this:
      
      <pre>
      namespace import_as ::private_namespace:my_proc1 my_proc2
      </pre>
      
      Using this command, there is a copy of <b>my_proc1</b> with name <b>my_proc2</b> in the current namespace
      
    5. foundin initialized to: "8.6"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "1c4b6cdb98c9dfc4d1e74018f3f4efa00ad217e2"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "21. [namespace]"
    15. title initialized to: "import proc from namespace with other name"
    16. type initialized to: "RFE"
  2. Ticket change [8cef93a49e] (rid 148810) by dgp on 2016-09-18 19:21:36:

    1. assignee changed to: "dgp"
    2. icomment:
      
      I strongly agree.
      
      I've always imagined this as a new option to
      [namespace import]:
      
      namespace eval my {
        namespace import -as bar ::orig::foo
      }
      
      so that then ::my::bar is an import of ::orig::foo
      This is more direct and tidier than the
      combination of [namespace import] and [rename]s
      that is otherwise needed.
      
    3. login: "dgp"
    4. mimetype: "text/plain"
  3. Ticket change [cfdd2a744c] (rid 149134) by dkf on 2016-10-09 15:46:37:

    1. icomment:
      The only issue is that we're currently having <tt>namespace import</tt> working on a whole set of stuff defined by a list of patterns; this renaming-as-we-go only really works with a single command.
      
      Not that it's a bad idea at all. Just needs documenting carefully.
      
    2. login: "dkf"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "dkf"
  4. Ticket change [987135153f] (rid 194209) by pooryorick on 2021-05-04 12:59:01:

    1. icomment:
      In the meantime, this can be trivially implemented as a script:
      
      <code><verbatim>
      proc import {link ns target} {
          set tmpns [info cmdcount]
          try {
              namespace eval $tmpns [list namespace import ${ns}::*]
              namespace eval $tmpns [list ::rename $target [
                  uplevel 1 {namespace current}]::$link]
          } finally {
              namespace delete $tmpns
          }
          return
      }
      </verbatim></code>
      
      
      Granted, importing all exported names is not so efficient, but it skirts
      pattern-matching issues.
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"