Skip to content
Tcl Source Code History Of Ticket 57e44de76e
Login

History Of Ticket 57e44de76e

Artifacts Associated With Ticket 57e44de76e

  1. Ticket change [31b5928c23] (rid 142436) by venkat on 2015-07-05 20:07:16:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      === start of a.tcl ===
      
      proc ::stracer {junk var op} {
          if {$var == ""} return
          switch $op {
              r {
                  puts "Read Fired"
                  set ::a($var) 5
              }
              w {
                  puts "Write Fired"
              }
          }
      }
      
      trace variable ::a rw ::stracer
      
      # set a(test2) 5
      puts "$a(test1)"
      
      === end of a.tcl ===
      
      Running:
      
      % tclsh8.6 a.tcl
      can't read "a(test1)": no such variable
          while executing
      "puts "$a(test1)""
          (file "a.tcl" line 17)
      
      
      Now remove the commented line (Remove # in "# set a(test2) 5)
      
      % tclsh8.6 a.tcl
      Write Fired
      Read Fired
      5
      
      ----
      
      Why does the write to the array change the behaviour of the read trace?
      
    5. foundin initialized to: "8.6.4"
    6. is_private initialized to: "0"
    7. login: "venkat"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "1fb8c275493b1f1dcf8db46d6d541794a011947f"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "venkat"
    14. subsystem initialized to: "07. Variables"
    15. title initialized to:
      Array Read Trace fires only if Array has been written to
      
    16. type initialized to: "Bug"
  2. Ticket change [b636a40753] (rid 142437) by venkat on 2015-07-05 21:49:07:

    1. foundin changed to: "8.6.4 296892a8fb4c0"
    2. login: "venkat"
    3. mimetype: "text/plain"
  3. Ticket change [256220657c] (rid 142438) by venkat on 2015-07-05 23:33:15:

    1. icomment:
      Instead of the write : "set a(test2) 5",  even a "array set a [list]" makes it work.     This might be a documentation issue rather than a code issue.
      
    2. login: "venkat"
    3. mimetype: "text/plain"
  4. Ticket change [312bff4c87] (rid 142439) by ferrieux on 2015-07-06 17:05:02:

    1. icomment:
      Yes: most likely the var must gain "array status" before the trace is set.
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"