Artifacts Associated With Ticket 1546833
Ticket change [f1fe9fbd5b] (rid 109452) by msofer on 2006-08-25 18:52:11:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Will Duquette reports by mail that varname resolution of [namespace upvar] is failing to do the right thing in the (non-fully) qualified case. <quote> Please consider the code: namespace eval ::cat:: { } namespace eval dog:: { set dogInfo(a) "A" set dogInfo(b) "B" } proc ::cat::TestProc {type} { if {![info exists ${type}::dogInfo]} { error "no such type: \"$type\"" } upvar ${type}::dogInfo dogInfo1 parray dogInfo1 namespace upvar $type dogInfo dogInfo2 parray dogInfo2 } ::cat::TestProc dog What happens when I run this is it prints the content of dogInfo1, but then says there is no array dogInfo2; [namespace upvar] is failing to alias dogInfo2 to ::dog::dogInfo. Now, the behavior of [namespace upvar] doesn't surprise me; since TestProc is in ::cat::, [namespace upvar] is presumably trying to alias dogInfo2 to ::cat::dog::dogInfo. That makes sense to me. [info exists] and [upvar], on the other hand, are finding ::dog::dogInfo; this surprises me. Do lookups of partially-qualified variable names fall back to :: if the variable isn't found in the current namespace? If so, [namespace upvar] should undoubtedly do the same thing. I must say, I wasn't expecting them to do that, though. </quote> - foundin initialized to: "obsolete: 8.5a5"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "msofer"
- subsystem initialized to: "21. [namespace]"
- title initialized to: "wrong varname resolution in [namespace upvar]"
- type initialized to: "Bug"
Ticket change [3e83312f01] (rid 121283) by msofer on 2006-08-26 01:58:52:
- icomment:
Logged In: YES user_id=148712 According to the docs, "[namespace upvar $ns a b] has the same behaviour as [upvar 0 $ns::a b]. Event though Will's example does not test this directly, further tests show that this is failing to occur. The code is buggy, and the testsuite incomplete.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [957e6b1a2b] (rid 106164) by msofer on 2006-08-26 09:30:17:
- icomment:
Logged In: YES user_id=148712 I now tend to think that [namespace upvar] is doing the right thing, and [upvar] is not. Note that upvar 0 b::x s b:y t may create vars that are linked to *different* namespaces; we certainly do not want to reproduce that in here. See also Bug #1274918
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [949c120e9f] (rid 106022) by msofer on 2006-08-26 19:54:29:
- closedate changed to: "2006-08-26T12:54:29"
- closer changed to: "msofer"
- icomment:
Logged In: YES user_id=148712 [namespace upvar] is doing the right thing: the man page for 'namespace' clearly states that "Namespace names, on the other hand, are always resolved by looking in only the current namespace." So this is actually a doc bug - the parallel to [upvar 0] is imperfect. This is now fixed in HEAD. There was an actual bug in the code (also fixed in HEAD), illustrated by % namespace eval a { variable x 2 proc a {} {namespace upvar fake x w; set w} a } 2 This now properly returns an error, with message namespace "fake" does not exist (see test upvar-NS-1.9) - login: "msofer"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- title changed to: "wrong varname resolution in [namespace upvar]?"
- username: "msofer"
Ticket change [fe89d867f3] (rid 108609) by dgp on 2006-08-27 10:49:29:
- icomment:
Logged In: YES user_id=80530 upvar-NS-1.3 segfaults.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "7 High"
- resolution changed to: "None"
- status changed to: "Open"
- username: "dgp"
- icomment:
Ticket change [8a2bd07474] (rid 127350) by dgp on 2006-08-27 11:36:24:
- assignee changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 The segfault appears to be in TclFormatObj() which is so far not used or tested anywhere else.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- username: "dgp"
Ticket change [8ec06a5bda] (rid 120167) by dgp on 2006-08-28 20:09:32:
- assignee changed to: "msofer"
- closedate changed to: "2006-08-28T13:09:32"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 TclFormatObj issue is now bug 1547681
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dgp"