Ticket UUID: | 959052 | |||
Title: | variable name resolution and unset vars | |||
Type: | Bug | Version: | obsolete: 8.5a3 | |
Submitter: | msofer | Created on: | 2004-05-23 20:10:04 | |
Subsystem: | 07. Variables | Assigned To: | msofer | |
Priority: | 5 Medium | Severity: | ||
Status: | Open | Last Modified: | 2006-10-02 04:48:53 | |
Resolution: | Postponed | Closed By: | msofer | |
Closed on: | 2004-05-25 19:53:45 | |||
Description: |
Name resolution for variablesin namespaces sometimes finds variables that "do not exist" according to [info vars]. % namespace eval a upvar x q % info vars x % namespace eval b set x 1 1 % set x 1 % trace add variable x write {;#} % info vars x % namespace eval a set x 1 1 % set x 1 % namespace eval a {trace add variable x write {;#}} % set x 0 0 % info vars a::x % namespace eval a set x 1 1 % set x 0 % info vars a::x ::a::x The variables which are found contrary to [info vars] satisfy: - they have an entry in their namespace's hash table - they are unset, ie (varPtr->flags & VAR_UNDEFINED) - they are not namespace variables, ie !(varPtr->flags & VAR_NAMESPACE_VAR) | |||
User Comments: |
msofer added on 2006-10-02 04:48:53:
Logged In: YES user_id=148712 Another surprise: % namespace eval a set x can't read "x": no such variable % set x 1 1 % namespace eval a set x 1 % upvar 0 ::a::x y % namespace eval a set x can't read "x": no such variable % msofer added on 2004-05-26 02:53:45: Logged In: YES user_id=148712 As many (?) scripts and apps (at least, AlphaTk: see bug #959786) rely on the details of the definition of "existence" for variable name resolution, they break with any change in these details. Any action on this bug will have to wait. The patch was reverted from HEAD, and should not be applied in the 8.4 line either. msofer added on 2004-05-24 08:37:54: Logged In: YES user_id=148712 Note that the final judge of which variable should be set is [namespace which -variable], according to namespace.n This is not changed by the patch. The patch insures that set name [namespace which -variable x] info vars $name always returns $name. Previously: % trace add variable x write {;#} % namespace eval a { set name [namespace which -variable x] } ::x % info vars ::x msofer added on 2004-05-24 05:48:51: File Added - 88161: 959052.patch msofer added on 2004-05-24 05:48:50: Logged In: YES user_id=148712 Attaching a patch, already committed to HEAD. Please review for itcl compat. Are there any other known users of Tcl_FindNamespaceVar that may rely on the weird lookup semantics? Second Q: should this be backported to 8.4? 8.3? |
Attachments:
- 959052.patch [download] added by msofer on 2004-05-24 05:48:50. [details]