Skip to content
Tcl Source Code History Of Ticket 218036
Login

History Of Ticket 218036

Artifacts Associated With Ticket 218036

  1. Ticket change [2f2349770d] (rid 93007) by nobody on 2000-10-26 00:52:25:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 1341 Bug
      Version: 8.0.4
      SubmitDate: '1999-03-02'
      LastModified: '1999-08-07'
      Severity: MED
      Status: Closed
      Submitter: pat
      ChangedBy: hobbs
      OS: Windows 98
      Machine: X86
      FixedDate: '2000-10-25'
      ClosedDate: '1999-08-07'
      
      
      Name:
      
      Richard Cochran
      
      
      
      ReproducibleScript:
      
      cmdline: tclsh80 test.tcl
      
      
      
      file test.tcl:
      
      #-----------------------
      
      
      
      set patterns(a) 1
      
      set patterns(b) 2
      
      set patterns(c) 3
      
      set patterns(d) 4
      
      set patterns(e) 5
      
      set patterns(f) 6
      
      
      
      parray patterns
      
      puts ""
      
      
      
      set s [array startsearch patterns]
      
      while 1 {
      
          set code [array anymore patterns $s] 
      
          puts "anymore? $code"
      
          if 0==$code break
      
          set tmp [array nextelement patterns $s]
      
          puts "the next element is: $tmp"
      
          puts "element,patterns(element) = $tmp, $patterns($tmp)"
      
      }
      
      array donesearch patterns $s
      
      puts ""
      
      
      
      set s [array startsearch patterns]
      
      while [array anymore patterns $s] {
      
          set tmp [array nextelement patterns $s]
      
          puts "the next element is: $tmp"
      
          puts "element,patterns(element) = $tmp, $patterns($tmp)"
      
      }
      
      
      
      
      
      
      
      
      
      
      
      ObservedBehavior:
      
      output from running test.tcl on MS Windows98:
      
      
      
      patterns(a) = 1
      
      patterns(b) = 2
      
      patterns(c) = 3
      
      patterns(d) = 4
      
      patterns(e) = 5
      
      patterns(f) = 6
      
      
      
      anymore? 1
      
      the next element is: d
      
      element,patterns(element) = d, 4
      
      anymore? 1
      
      the next element is: e
      
      element,patterns(element) = e, 5
      
      anymore? 1
      
      the next element is: a
      
      element,patterns(element) = a, 1
      
      anymore? 1
      
      the next element is: f
      
      element,patterns(element) = f, 6
      
      anymore? 1
      
      the next element is: b
      
      element,patterns(element) = b, 2
      
      anymore? 1
      
      the next element is: c
      
      element,patterns(element) = c, 3
      
      anymore? 0
      
      
      
      the next element is: d
      
      element,patterns(element) = d, 4
      
      the next element is: e
      
      element,patterns(element) = e, 5
      
      the next element is: a
      
      element,patterns(element) = a, 1
      
      the next element is: f
      
      element,patterns(element) = f, 6
      
      the next element is: b
      
      element,patterns(element) = b, 2
      
      the next element is: c
      
      element,patterns(element) = c, 3
      
      the next element is:
      
      can't read "patterns()": no such element in array
      
          while executing
      
      "puts "element,patterns(element) = $tmp, $patterns($tmp)""
      
          ("while" body line 4)
      
          invoked from within
      
      "while [array anymore patterns $s] {
      
          set tmp [array nextelement patterns $s]
      
          puts "the next element is: $tmp"
      
          puts "element,patterns(elemen..."
      
          (file "test.tcl" line 24)
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      DesiredBehavior:
      
      The output running test.tcl on Linux 
      
      (what I expect to see):
      
      
      
      patterns(a) = 1
      
      patterns(b) = 2
      
      patterns(c) = 3
      
      patterns(d) = 4
      
      patterns(e) = 5
      
      patterns(f) = 6
      
      
      
      anymore? 1
      
      the next element is: d
      
      element,patterns(element) = d, 4
      
      anymore? 1
      
      the next element is: e
      
      element,patterns(element) = e, 5
      
      anymore? 1
      
      the next element is: a
      
      element,patterns(element) = a, 1
      
      anymore? 1
      
      the next element is: f
      
      element,patterns(element) = f, 6
      
      anymore? 1
      
      the next element is: b
      
      element,patterns(element) = b, 2
      
      anymore? 1
      
      the next element is: c
      
      element,patterns(element) = c, 3
      
      anymore? 0
      
      
      
      the next element is: d
      
      element,patterns(element) = d, 4
      
      the next element is: e
      
      element,patterns(element) = e, 5
      
      the next element is: a
      
      element,patterns(element) = a, 1
      
      the next element is: f
      
      element,patterns(element) = f, 6
      
      the next element is: b
      
      element,patterns(element) = b, 2
      
      the next element is: c
      
      element,patterns(element) = c, 3
      
      
      
      
      
      
      
      
      
      
      
      
      
      I can't understand why this simple script doesn't produce the
      
      same output on Windows as on Linux. If its not a bug, then it is a
      
      very stange anomoly.
      
      
      
      The windows behavior is correct, and the behavior on Linux is
      
      suspect (check version numbers).  The problem is that in the
      
      while loop, the condition is not {}ed, so it is evaluated only
      
      the first time to 1, and will thus always loop until your error.
      
      If you do:
      
          while {[array anymore patterns $s]} { ...
      
      instead, you will get the expected behavior.
      
       
      
      -- 08/07/1999 hobbs
      
    4. foundin initialized to: "obsolete: 8.0.4"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to: "MSWindows: array anymore fails as while condition"
    11. type initialized to: "Bug"
  2. Ticket change [b33be0a141] (rid 98489) by welch on 2000-10-26 08:13:43:

    1. closedate changed to: "2000-10-26T01:13:43"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [e455cd9a6f] (rid 87934) by dgp on 2001-04-16 23:48:48:

    1. closedate changed to: "2001-04-16T16:48:48"
    2. closer changed to: "dgp"
    3. subsystem changed to: "45. Parsing and Eval"