Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: dd0564b5ea4012c22a3ee1bba647ce1fab6d1b78
Ticket: 835020ffffffffffffffffffffffffffffffffff
lassign to member variables in itcl methods
User & Date: msofer on 2003-11-20 23:50:10
Changes

  1. icomment:
    Logged In: YES 
    user_id=148712
    
    Eril Allaert reports in clt (verified with 8.4.4):
    Try the following script, using tclsh:
    
      package require Itcl
      package require Tclx
    
      itcl::class Test {
          variable x 0
          variable y 0
    
          constructor {args} {
              prep;                # this should modify x and y ...
              puts "$x [incr y]";  # ... which should be
    noticeable here
          }
          method prep {} {
              loop x 1 3 {puts "$x [incr y]"}
              puts "local vars: >[info locals]<"
          }
      }
    
      Test t
    
    Expected output: 4 lines containing resp "1 1", "2 2",
    "local vars: ><"
    and "3 3". You get exactly that with Tcl 8.3.4, [incr Tcl]
    3.2 and
    TclX 8.3.5. But with Tcl 8.4.3, iTcl 3.3 and TclX 8.4 the
    last line
    is "0 3", and the one before "local vars: >x<". Same if Tcl
    is upgraded
    to Tcl 8.4.4.
    
    Replacing TclX's loop command in the method prep by any of
    the 17 other
    TclX commands that require a variable name as argument
    demonstrates the
    same problem. The work-around to get this working again as
    expected is
    to have at least one standard Tcl command referring to this
    variable
    (e.g. "set x") anywhere within this prep method. This was
    reported as
    bug 835020 on SF, but initially mentioned only TclX's
    "lassign" command.
    
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. priority changed to: "8"
  5. username: "msofer"