Skip to content
Tcl Source Code History Of Ticket ba79c2f0ce408c09
Login

History Of Ticket ba79c2f0ce408c09

Artifacts Associated With Ticket ba79c2f0ce408c09

  1. Ticket change [28c0b1b990] (rid 151680) by anonymous on 2017-01-30 20:02:52:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. 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
      
    5. foundin initialized to: "8.6.4"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "96d40012292bbe2f33abb1ebc8a4a02fc9de73ff"
    10. resolution initialized to: "None"
    11. severity initialized to: "Severe"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "38. Init - Library - Autoload"
    15. title initialized to:
      Use of Iwidgets with auto load and namespace import result in command errors
      
    16. type initialized to: "Bug"
  2. Ticket change [6c32b4429f] (rid 151723) by fvogel on 2017-02-01 21:24:11:

    1. icomment:
      Same ticket [http://core.tcl.tk/tk/tktview/c2290bd04bd915d0d2e99256a2f14016fb05708a|in the Tk tracker].
      
    2. login: "fvogel"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [25373ebfa7] (rid 151982) by dgp on 2017-02-21 18:05:41:

    1. 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.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  4. Ticket change [c44f174801] (rid 151983) by dgp on 2017-02-21 19:53:39:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2457806.32892377"
    3. closer changed to: "dgp"
    4. 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.
      
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. resolution changed to: "Wont Fix"
    8. status changed to: "Closed"
    9. subsystem changed to: "81. Bundled Packages"
    10. title changed to:
      Use of Itcl with auto load and namespace import result in command errors