|
2005-09-02
| ||
| 20:46 | • Ticket [1280497fff] set a variable in namespace set global variable status s... artifact: 1d357c0081 user: msofer | |
| 20:46 | • Closed ticket [1280497fff]. artifact: ec433a14a2 user: msofer | |
| 19:15 | • Ticket [1280497fff]: 4 changes artifact: a688c87d16 user: dkf | |
| 10:24 | • New ticket [1280497fff]. artifact: 1be3bd323c user: nobody | |
set a variable in namespace set global variable
Closed / Invalid1280497fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-09-02 10:24:03
GNU/Linux 2.6.8-24.17-default i686 athlon
patchlevel -- 8.4.11
% set data 0
0
% namespace eval ::ini { set data 1 }
1
% puts $data
1
% puts $::ini::data
can't read "::ini::data": no such variable
[email protected]
dkfplain2005-09-02 19:15:46
Logged In: YES user_id=79902 This is, believe it or not, how variable resolution is supposed to work, i.e. it is designed that way. Stupid, isn't it? Altering this would be an RFE, not a bugfix...
msofer Closed ticket [1280497fff].
[History diff]2005-09-02 20:46:06
msoferplain2005-09-02 20:46:07
Logged In: YES user_id=148712 Works as documented, see the [namespace] manual page (especially the section NAME RESOLUTION): http://www.tcl.tk/man/tcl8.4/TclCmd/namespace.htm#M22 FWIW, we all seem to agree that this rule for variable name resolution is crazy. Changing this is very delicate, for backwards compatibility reasons. Let's hope it happens for Tcl9.0 The way out is to "declare" namespace variables using the [variable] command. For some other related pitfalls, see bug #959052.
Log in (anonymous is fine) to add a comment.