Artifacts Associated With Ticket ba79c2f0ce408c09
Ticket change [28c0b1b990] (rid 151680) by anonymous on 2017-01-30 20:02:52:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Any command imported (namespace import) from a script that has been auto_loaded fails if used in conjunction with the Iwidgets package. This is true for 8.5 and 8.6 Consider the following two procs: src.tcl -------------------------------------- namespace eval src { proc a {} {return "alpha"} proc b {} {return "beta"} proc etc {} {return "..."} namespace export a b } dst.tcl ------------------------------------------- package require Iwidgets lappend ::auto_path [file dirname [info script]] puts $::auto_path namespace eval dst { namespace import ::src::* proc c {} {return "Charlie"} puts "[a] [b] [c]" } use mk to create a tcl index and run dst. The result "a" is an invalid command. Next: comment the package require. => alpha beta charlie Now, consider the mods to dst.tcl - namespace import commented. dst.tcl ---------------------------------- package require Iwidgets lappend ::auto_path [file dirname [info script]] puts $::auto_path namespace eval dst { #namespace import ::src::* proc c {} {return "Charlie"} puts "[::src::a] [::src::b] [c]" } => alpha beta charlie - foundin initialized to: "8.6.4"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "96d40012292bbe2f33abb1ebc8a4a02fc9de73ff"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "38. Init - Library - Autoload"
- title initialized to:
Use of Iwidgets with auto load and namespace import result in command errors
- type initialized to: "Bug"
Ticket change [6c32b4429f] (rid 151723) by fvogel on 2017-02-01 21:24:11:
- icomment:
Same ticket [http://core.tcl.tk/tk/tktview/c2290bd04bd915d0d2e99256a2f14016fb05708a|in the Tk tracker].
- login: "fvogel"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [25373ebfa7] (rid 151982) by dgp on 2017-02-21 18:05:41:
- icomment:
Itcl replaces the [::auto_import] with its own customized version. The customized approach adds another layer of indirection. On [namespace import] all indexed auto-load-able commands have stub-versions created, which will then only invoke the actual auto-loading when the are called. The problem with this is that it misses the [namespace export] command that takes place when the actual auto-loading [source]s the implementation. With out an enabling [namespace export], the [namespace import] fails to get the auto-loaded command. This is so broken, I cannot imagine anyone wishing for this, but since I'm not an Itcl user it's hard to say with any confidence.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [c44f174801] (rid 151983) by dgp on 2017-02-21 19:53:39:
- assignee changed to: "dgp"
- closedate changed to: "2457806.32892377"
- closer changed to: "dgp"
- icomment:
I looked. I tried. I will not fix this. Itcl breaks Tcl's built-in hackery to try to make the snapshot-oriented command [namespace import] "Do What You Mean" in combination with the "delay until the last minute" scheme of the built-in auto-loader. Choose one or the other, magical imports of autoloaded commands or use of the Itcl package, but you cannot have both. Accommodating this was a dumb idea to begin with. [namespace import] has snapshot semantics. That's documented. So create commands before you attempt to [namespace import] them. You cannot make water that is not wet. You cannot take a snapshot of something that hasn't yet been brought into existence. Beyond that, give serious contemplation to ditching all use of Tcl's built-in auto-load system completely. It's ancient, not well-maintained, and the case for it is very hard to make anymore. If you can make the case, you can make your own stub-powered auto-loading scheme that works better in every way than this relic. As a workaround to the trouble reported in the ticket, you could remove the definition of [::auto_import] found in the itcl.tcl file installed as part of your Itcl installation. That will avoid the bug associated with this ticket, but I have no idea what impact that may have on the internal expectations of Itcl. Test suite doesn't care, but only a fool thinks the Itcl test suite is comprehensive. That workaround is what I would adapt if I had confidence it would not upset established Itcl uses. At this point though, the only winning move is not to play.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Wont Fix"
- status changed to: "Closed"
- subsystem changed to: "81. Bundled Packages"
- title changed to:
Use of Itcl with auto load and namespace import result in command errors