Artifacts Associated With Ticket 1242314fffffffffffffffffffffffffffffffff
Ticket change [2b189629c7] (rid 118678) by nobody on 2005-07-21 14:03:14:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Sorry but I cannot test this now with newer releases. From the [upvar] manual page: "If an upvar variable is unset [...] the unset operation affects the variable it is linked to, not the upvar variable. There is no way to unset an upvar variable except by exiting the procedure in which it is defined." Playng with tclsh: /usr/local/bin/tclsh 8.4 (marco) % set tcl_version 8.4 /usr/local/bin/tclsh 8.4 (marco) % info patchlevel 8.4.8 /usr/local/bin/tclsh 8.4 (marco) % set a 1 1 /usr/local/bin/tclsh 8.4 (marco) % proc p {} { upvar a b ; puts $b ; unset b } /usr/local/bin/tclsh 8.4 (marco) % p 1 /usr/local/bin/tclsh 8.4 (marco) % set a can't read "a": no such variable /usr/local/bin/tclsh 8.4 (marco) % Ciao. - foundin initialized to: "obsolete: 8.4.8"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "07. Variables"
- title initialized to: "usetting upvar alias unsets upvar variable"
- type initialized to: "Bug"
Ticket change [eaf24d2156] (rid 103452) by msofer on 2005-07-21 22:13:55:
- icomment:
Logged In: YES user_id=148712 The language may be somewhat confusing ... but what you see is precisely what is documented. When you do 'upvar a b', the docs call b 'the upvar variable' (ie, the variable created by the upvar command); it is linked to the variable a. Hence, the docs say that 'unset b' actually unsets a, just as you observed. I'll leave this open and consider it a documentation bug: maybe we can come up with a description less likely to confuse, or add an example.
- login: "msofer"
- mimetype: "text/plain"
- title changed to: "confusing unset/upvar documentation "
- username: "msofer"
- icomment:
Ticket change [782a83c297] (rid 89909) by marcomaggi on 2005-07-27 02:15:28:
- icomment:
Logged In: YES user_id=727156 Fine. I agree with the documentation bug and the need for the example. Maybe the code that I used to show it is enough. I propose two changes: "If an upvar variable is unset (e.g. x in add2 above), the unset operation affects the variable it is linked to, not the upvar variable." should be: "If the unset command is invoked with an upvar variable as argument (e.g. x in add2 above), the unset operation affects both the variable it is linked to, and the upvar variable." The phrase: "There is no way to unset an upvar variable except by exiting the procedure in which it is defined. However, it is possible to retarget an upvar variable by executing another upvar command." should be: "There is no way to unlink an upvar variable from the linked one without unsetting both, except by exiting the procedure in which it is defined or by retargeting the upvar variable by executing another upvar command." - login: "marcomaggi"
- mimetype: "text/plain"
- username: "marcomaggi"
- icomment:
Ticket change [a4ee8bfe7a] (rid 110284) by msofer on 2006-03-11 21:12:36:
- closedate changed to: "2006-03-11T14:12:36"
- closer changed to: "msofer"
- icomment:
Logged In: YES user_id=148712 Revisiting after such a long time ... I do not agree with your reformulations: the unset operation does not affect the upvar variable, and it does not destroy the link. It just unsets the variable to which the link was created. Witness % set x 1 1 % upvar 0 x y % set y 1 % unset y % set x can't read "x": no such variable % set y 2 2 % set x 2
- login: "msofer"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Pending"
- username: "msofer"
Ticket change [200cda891e] (rid 91248) by sf-robot on 2006-03-26 10:21:10:
- icomment:
Logged In: YES user_id=1312539 This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).
- login: "sf-robot"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "sf-robot"
- icomment:
Ticket change [939c491fa7] (rid 105847) by sf-robot on 2006-03-26 10:21:11:
- closedate changed to: "2006-03-26T03:21:11"
- closer changed to: "sf-robot"