Skip to content
Tcl Source Code History Of Ticket 231259
Login

History Of Ticket 231259

Artifacts Associated With Ticket 231259

  1. Ticket change [ac0d86eb5f] (rid 101227) by msofer on 2001-02-06 14:43:08:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      According to the comments for the function TclResetShadowedCmdRefs in generic/tclNamesp.c the following should not happen:
      
         % #define a namespace proc that uses the global command 'set'
         % namespace eval mig {proc test {} {set ::g 0}}; mig::test
         0
        %  
        % #define a namespace proc 'set' that shadows the global command; 
        % #the previously compiled 'test' never notices!
        % namespace eval mig {proc set {a b} {::set a [incr b]}}; mig::test   0
        % #>>>>>>>>>>>
        % #? Shouldn't the namespace epoch have been bumped up by the 
        % #shadowing, ? so that all procs are recompiled?
        % #>>>>>>>>>>>
        %
        % #if I redefine, and hence force recompilation of 'test', it is ok.)   
        % namespace eval mig {proc test {} {set ::g 0}}; mig::test
         1
        
      
    4. foundin initialized to: "obsolete: 8.4a2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "msofer"
    9. subsystem initialized to: "21. [namespace]"
    10. title initialized to: "cmdRefEpoch not updated"
    11. type initialized to: "Bug"
  2. Ticket change [299c15bce7] (rid 88896) by msofer on 2001-02-06 23:06:27:

    1. icomment:
      Sorry for the title, it is way too specific and maybe misleading! A correct title would be 
      * Incorrect command scoping *
      
      I do not actually know if, in the example above, cmdRefEpoch was not updated, or if it was but the bytecompiler ignored it.
      
      msofer
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [4b7f59cbac] (rid 126723) by msofer on 2001-02-08 01:35:19:

    1. icomment:
      It seems to be a deeper bug; some global commands (eg, set) are compiled directly to bytecode. Commands that shadow *them* are immune to the implementation of the 'reset on shadowing': it invalidates command *references* in the bytecode, but there is no command reference to 'set' in there!
      Maybe shadowing should force recompilation of the proc, and not just a fresh resolution of command names? In that case, a small patch to TclProcCompileProc (generic/tclProc.c) would arrange it.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  4. Ticket change [5a120fa017] (rid 118079) by msofer on 2001-02-08 03:25:51:

    1. icomment:
      I am submitting a patch to tclProc.c that fixes this. 
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  5. Ticket change [f6a8827a04] (rid 130331) by msofer on 2001-02-08 04:16:51:

    1. icomment:
      No, I'm not ... 
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  6. Ticket change [6e32d3da63] (rid 128831) by msofer on 2001-04-07 10:51:25:

    1. priority changed to: "3 Low"
  7. Ticket change [142bc171e7] (rid 124345) by msofer on 2001-04-07 10:51:26:

    1. assignee changed to: "msofer"
  8. Ticket change [adde6047c2] (rid 101532) by msofer on 2001-05-11 02:14:21:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      A different aspect of the same bug is shown by the example:
      
      % namespace export set
          namespace eval mig {
              namespace import ::set
              rename set mySet
      
              proc test {a} {
                  variable var
                  mySet var $a
              }
      
              test 0
              set var0 $var
      
              rename mySet {}
              proc mySet {var val} {
                  set $var [expr $val + 1]
              }
      
              test 0
              set var1 $var
      
              puts "$var0 $var1"
          }
      % 0 0
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  9. Ticket change [b4a67453c3] (rid 125077) by msofer on 2001-05-11 03:50:33:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Sorry about that "second example"; it is only an example of
      how stupid one gets when doing things in haste ...
      
      No bug in that situation if programmed correctly: the
      redefinition of 'mySet' should have a body 
          {uplevel set $var [expr $val + 1]}
      and then things work out as they should ...
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  10. Ticket change [e493c617ae] (rid 87976) by msofer on 2001-05-11 03:57:08:

    1. foundin changed to: "obsolete: 8.4a3"
    2. title changed to: "shadowing byte-compiled commands"
  11. Add attachment "231259.txt" [1bf7daf48d] (rid 90524) by msofer on 2001-05-11 05:54:42.

  12. Ticket change [ce710a4260] (rid 96056) by msofer on 2001-05-11 05:54:42:

    1. icomment:
      
      
      File Added - 6189: 231259.txt
      
      Logged In: YES 
      user_id=148712
      
      I enclose a patch for review. Only issue I see: the usage of
      the 
         nsPtr->resolverEpoch 
      to force recompilation in the namespace. Maybe we should
      change the name to 
         nsPtr->compileEpoch
      throughout? 
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  13. Ticket change [42a475d6a8] (rid 116419) by msofer on 2001-05-15 21:23:13:

    1. closedate changed to: "2001-05-15T14:23:13"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Patch committed
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "msofer"
  14. Ticket change [3aaa8bc65e] (rid 112596) by msofer on 2001-11-29 21:42:49:

    1. closedate changed to: "2001-11-29T14:42:49"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      A simpler example (will go into the tests) is:
      
      namespace eval test {variable b 0}
      
      proc test::a {i} {
          variable b
          proc set args {return "New proc is called"}
          return [set b $i]
      }
      
      list [test::a 1] [test::a 2] $test::b
      
      The correct output is
      
      1 {New proc is called} 1
      
      and the output without the patch is
      
      1 2 2
      
      Explanation: 
      
        - at the first run of test::a [::set] is called as it was
      compiled into the proc  body. We cannot see the effects of a
      redefinition of a bcc'ed command from within the bytecode
      that did the redefinition, as it will run to the end once it
      starts executing.
      
        - at successive runs, the shadowed command is detected and
      a recompilation is forced: the new definition is used.
      
      
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. username: "msofer"
  15. Ticket change [d3785b2fd2] (rid 123297) by msofer on 2001-11-30 03:10:39:

    1. closedate changed to: "2001-11-29T20:10:39"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Patch back-ported to the core-8-3-1-branch
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. username: "msofer"