Artifacts Associated With Ticket 1274918fffffffff
Ticket change [724f6d3095] (rid 100835) by msofer on 2005-08-28 01:36:47:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
This supersedes Bug #959831. There are two (related, important) issues that the [upvar] docs do not describe: what it does when called outside a proc body, and how it handles qualified variable names. The behaviour outside of proc bodies just needs documenting: upvar ?level? otherVar myVar ?otherVar myVar ...? will create a variable named myVar in the current namespace (assuming for now that myVar is not qualified) linked to the variable otherVar as resolved in the corresponding stack frame. This is the same behaviour as documented in upvar.c, just replacing "current procedure" by "current context". The fact that this variable can never be unset until the namespace is deleted deserves mention - and maybe a fix too? The behaviour when otherVar is qualified is completely unspecified in the manual page. This may not be a problem, the behaviour is without surprises: the variable that is linked to is otherVar as resolved in the corresponding stack frame. The behaviour when myVar is qualified is also unspecified in the manual page, and is currently buggy (Bug #1274916).
- foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "msofer"
- subsystem initialized to: "07. Variables"
- title initialized to: "doc: upvar and qualified varNames"
- type initialized to: "Bug"
Ticket change [4bd9a39c78] (rid 126774) by msofer on 2006-08-26 02:45:32:
- icomment:
Logged In: YES user_id=148712 Note that the issue for qualified otherVar is not quite trivial: % namespace eval a {}; namespace eval a::b {}; namespace eval b {} % set b::x ::b ::b % namespace eval a {upvar 0 b::x w; set w} ::b % set a::b::x ::a::b ::a::b % namespace eval a {upvar 0 b::x w; set w} ::a::b In the example above namespace eval a {upvar 0 b::x w} the new variable should(?) be linked (in order) to: (1) ::a::b::x if the namespace ::a::b exists (2) ::b::x if the namespace ::b exists Note that this refers to the existence of namespaces; the usual resolution rules (and the actual upvar behaviour) refer to the existence of the variables themselves, the reference is to: (1) ::a::b::x if the variable ::a::b::x exists (2) ::b::x if the variable ::b::x exists (3) ::a::b::x otherwise (even if ::b exists but ::a::b does not) - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [25604fc518] (rid 88163) by msofer on 2006-08-26 09:26:37:
- icomment:
Logged In: YES user_id=148712 There is madness in here: % namespace eval a {namespace eval b {}} % namespace eval b {} % set b::x 1 1 % namespace eval a { upvar 0 b::x s b::y t set s 2 set t 3 } 3 % set b::x 2 % info vars b::* ::b::x % info vars a::b::* ::a::b::y Ie: [upvar 0 b::x s b::y t] creates vars linked to different namespaces. This is definitely not the path of least surprise. - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [a1fb5c3cb4] (rid 109816) by msofer on 2006-09-30 08:09:52:
- priority changed to: "8"
Ticket change [6ca5fcdc57] (rid 128552) by msofer on 2009-05-01 08:21:25:
- priority changed to: "7 High"