Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8746d191af508a1099c9e76305b9adbca96ccbf7
Ticket: 1768830fffffffffffffffffffffffffffffffff
Documentation of "upvar" command
User & Date: nobody on 2007-08-06 21:26:48
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The following is taken from the online description of the "upvar" command which was generated from Tcl CVS HEAD.
    
    SYNOPSIS
    upvar ?level? otherVar myVar ?otherVar myVar ...?
    
    DESCRIPTION
    The variable named by otherVar need not exist at the time of the call; it will be created the first time myVar is referenced, just like an ordinary variable.
    
    
    The statement that "otherVar" will be created in case of a call to "myVar" is confusing and probably wrong.
    In case of a call to "myVar" or if used the first time and if the referenced "otherVar" does not exist a error will be raised by the tcl interpreter that "myVar" can't be read because it is not existing. This is because "myVar" references to nothing.
    
    The following example will illustrate this with the second procedure call:
    
    #!/usr/bin/tclsh
    
    proc CallOn { variable } {
        upvar $variable variableRef
        puts "variable=$variable"
        puts "variableRef=$variableRef"
    }
    set v "Test"
    
    CallOn v  ; # by name
    CallOn $v ; # by value
    
    
  4. foundin changed to: "obsolete: 8.5a7"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "nobody"
  10. subsystem changed to: "07. Variables"
  11. title changed to: "Documentation of "upvar" command"
  12. type changed to: "Bug"