[namespace which -variable ary(i)] returns a null
string even when ary(i) exists! This is a major pain
when trying to get fully scoped variable names to give
to widgets. Here is a script snippet that shows the
eror:
Got submitted to quick...
namespace eval a {
variable ary
set ary(i) v
puts "1 - [namespace which -variable ary]"
set x ary
set y ary(i)
puts "2 - [namespace which -variable $x]"
puts "3 - [namespace which -variable $y]"
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(1) Sorry, this bug somehow flew under my horizon :(
(2) It's not so clear to me what the correct fix would be:
what should happen if the array itself exists, but the array
element does not? In your script, what is the expected
result of adding a line
puts "4 - [namespace which -variable ary(k)]"
According to the man page, the return should be "" - is this
what you're expecting?
(3) Depending on the answer to (2), a workaround involving
[info exists] may be the solution for now.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This cannot be fixed at reasonable cost without changing the
Var struct: an array element does not know it's containing
array, even though it knows its hashtable.
This will probably not happen until Tcl9. Leaving the bug
open to fix at that time.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=338658
Got submitted to quick...
namespace eval a {
variable ary
set ary(i) v
puts "1 - [namespace which -variable ary]"
set x ary
set y ary(i)
puts "2 - [namespace which -variable $x]"
puts "3 - [namespace which -variable $y]"
}
Logged In: YES
user_id=148712
(1) Sorry, this bug somehow flew under my horizon :(
(2) It's not so clear to me what the correct fix would be:
what should happen if the array itself exists, but the array
element does not? In your script, what is the expected
result of adding a line
puts "4 - [namespace which -variable ary(k)]"
According to the man page, the return should be "" - is this
what you're expecting?
(3) Depending on the answer to (2), a workaround involving
[info exists] may be the solution for now.
Logged In: YES
user_id=148712
This cannot be fixed at reasonable cost without changing the
Var struct: an array element does not know it's containing
array, even though it knows its hashtable.
This will probably not happen until Tcl9. Leaving the bug
open to fix at that time.