Overview
| Artifact ID: | d1ac289e5790102315560113d38e7cd85214d562 |
|---|---|
| Ticket: | 218782ffffffffffffffffffffffffffffffffff
trace variable / upvar problem |
| User & Date: | nobody on 2000-10-26 01:05:17 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
OriginalBugID: 2110 Bug Version: 8.1 SubmitDate: '1999-05-20' LastModified: '2000-01-20' Severity: LOW Status: Released Submitter: pat ChangedBy: ericm OS: All FixedDate: '2000-01-20' FixedInVersion: 8.3 ClosedDate: '2000-01-20' Name: Greg Orchard ReproducibleScript: proc update {name index op} { puts "name $name index $index" } proc getUpdate {inVar} { upvar $inVar localVar set localVar 100 } trace variable somevar w update getUpdate somevar(1) ObservedBehavior: The output from the above is: name localVar index DesiredBehavior: I would expect to see: name somevar index 1 since "somevar" is the one variable being traced. This is actually the designed behaviour. While it may seem obivously incorrect, consider the case in which there are two levels of upvar, and multiple traces: proc update {name index op} { puts "name $name index $index" } proc getUpdate {inVar} { upvar $inVar localVar trace variable localVar w update getUpdate2 localVar } proc getUpdate2 {inVar} { upvar $inVar localVar2 set localVar2 100 } trace variable somevar w update getUpdate somevar Now it is not so clear what the behaviour should be. Which trace should fire? what name should it be given? If there are many levels of indirection, it could be costly to try and determine which trace should be fired with which variable name. And because all of the variable names actually refer to the same object, it is least confusing to fire all of the traces with the name used to trigger the trace. - eric -- 01/20/2000 ericm - foundin changed to: "obsolete: 8.1"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "07. Variables"
- title changed to: "trace variable / upvar problem"
- type changed to: "Bug"