Artifacts Associated With Ticket c9ca7bca7e
Ticket change [6009146fa7] (rid 148809) by anonymous on 2016-09-18 00:17:44:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/html"
- 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
- foundin initialized to: "8.6"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "1c4b6cdb98c9dfc4d1e74018f3f4efa00ad217e2"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "21. [namespace]"
- title initialized to: "import proc from namespace with other name"
- type initialized to: "RFE"
Ticket change [8cef93a49e] (rid 148810) by dgp on 2016-09-18 19:21:36:
- assignee changed to: "dgp"
- 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. - login: "dgp"
- mimetype: "text/plain"
Ticket change [cfdd2a744c] (rid 149134) by dkf on 2016-10-09 15:46:37:
- 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.
- login: "dkf"
- mimetype: "text/x-fossil-wiki"
- username: "dkf"
- icomment:
Ticket change [987135153f] (rid 194209) by pooryorick on 2021-05-04 12:59:01:
- 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. - login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- icomment: