Overview
| Artifact ID: | f1fe9fbd5b272c67221cb67dd10e622c1a8e1f45 |
|---|---|
| Ticket: | 1546833fffffffffffffffffffffffffffffffff
wrong varname resolution in [namespace upvar]? |
| User & Date: | msofer on 2006-08-25 18:52:11 |
Changes
- assignee changed to: "msofer"
- cmimetype changed to: "text/plain"
- comment changed 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 changed to: "obsolete: 8.5a5"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "msofer"
- subsystem changed to: "21. [namespace]"
- title changed to: "wrong varname resolution in [namespace upvar]"
- type changed to: "Bug"