Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e3aae74d0cc239e8eed78b3ac7edcfb90a9d1c5a
Ticket: 218546ffffffffffffffffffffffffffffffffff
"variable foo(x)" has inconsistant behavior
User & Date: nobody on 2000-10-26 01:01:59
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 981 Bug
    Version: 8.3b2
    SubmitDate: '1998-12-16'
    LastModified: '2000-01-20'
    Severity: SER
    Status: Released
    Submitter: admin
    ChangedBy: ericm
    OS: All
    FixedDate: '2000-01-20'
    FixedInVersion: 8.3
    ClosedDate: '2000-10-25'
    
    
    The original bug description is below the --------snip--------- line below.  That description, however, acknowledges that the bug was fixed in 8.1, by changing the behavior of "variable foo(x)".  But in investigating the bug, I found this behavior:
    
    namespace eval bar {
    variable foo(1)
    }
    => can't define "foo(1)": no such element in array
    
    However:
    
    namespace eval boo { 
    set foo(1) x
    variable foo(1)
    }
    => # no error
    
    I corrected this by making the variable command always return an error when the variable name given refers to an array element:
    
    namespace eval bar {
            variable foo(1)
    }
    can't define "foo(1)": name refers to an element in an array
    
    - eric
    
    Original bug report below.
    -------------------snip-------------------------
    
    In 8.0.4, the command "variable foo(x)" creates a scalar variable
    "foo(x)" that is not related to the foo array.
    
    This bug is not present in 8.1, where the variable command
    raises an error.
    
    # repeatable script
    
    namespace eval ns {
        variable a
        array set a {
    1one
    2two
        }
    }
    proc ns::bug {varname value} {
        variable $varname $value
    }
    ns::bug a(3) three
    puts "[info vars ns::*]"
    
    
    
    Fixed in 8.3.
    
    - eric
     
    -- 01/20/2000 ericm
    
  4. foundin changed to: "obsolete: 8.3b2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "07. Variables"
  10. title changed to: ""variable foo(x)" has inconsistant behavior"
  11. type changed to: "Bug"