|
2017-05-16
| ||
| 07:18 | • Ticket [472113ffff] namespace which -var fails for ary(i) status still Ope... artifact: 529616e502 user: oehhar | |
|
2017-05-15
| ||
| 17:56 | • Ticket [472113ffff]: 3 changes artifact: 20681b4ae0 user: sebres | |
| 11:46 | • Ticket [472113ffff]: 7 changes artifact: 15f940948a user: oehhar | |
|
2009-05-01
| ||
| 08:30 | • Ticket [472113ffff]: 1 change artifact: 31e27e657d user: msofer | |
|
2006-10-01
| ||
| 22:07 | • Ticket [472113ffff]: 4 changes artifact: 4b75ce7546 user: msofer | |
|
2003-11-13
| ||
| 08:36 | • Ticket [472113ffff]: 1 change artifact: 1b793a1123 user: dgp | |
|
2002-08-08
| ||
| 03:13 | • Ticket [472113ffff]: 4 changes artifact: 192fc9eae5 user: msofer | |
|
2002-01-15
| ||
| 20:14 | • Ticket [472113ffff]: 1 change artifact: 438784ac6b user: dgp | |
|
2001-10-17
| ||
| 23:01 | • Ticket [472113ffff]: 1 change artifact: 61b4951670 user: hartweg | |
| 22:58 | • Ticket [472113ffff]: 4 changes artifact: 749c765d88 user: hartweg | |
| 15:41 | • New ticket [472113ffff]. artifact: 1d76cb422d user: hartweg | |
[namespace which -var] fails for ary(i)
Open472113ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 10 years ago
Descriptionplain2001-10-17 15:41:42
[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:
hartwegplain2001-10-17 22:58:23
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]"
}
hartweg Ticket [472113ffff]: 1 change
[History diff]2001-10-17 23:01:20
dgp Ticket [472113ffff]: 1 change
[History diff]2002-01-15 20:14:45
msoferplain2002-08-08 03:13:25
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.
dgp Ticket [472113ffff]: 1 change
[History diff]2003-11-13 08:36:13
msoferplain2006-10-01 22:07:23
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.
msofer Ticket [472113ffff]: 1 change
[History diff]2009-05-01 08:30:08
oehharwiki2017-05-15 11:46:42
Miquel Sofer wrote:
(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?
Let me express my expectation. [namespace which -variable ary(k)] should do the following:
- resolve "ary" in the local scope
- check if it is an array. If not -> error
- format the result the same way as [namespace which -variable ary](k). This means, that the existence of the given array index must not exist and is not relevant. The existance of the array and its scope is important.
sebreshtml2017-05-15 17:56:00
check if it is an array. If not -> errorI guess, it should rather return "" in this case, because currently "namespace which" will never produce an error (by valid command syntax). It would be also similar to "no error" (just empty return) by following code:
unset -nocomplain novar namespace which -variable novar
oehharwiki2017-05-16 07:18:48
Sebres wrote:
I guess, it should rather return "" in this case, because currently "namespace which" will never produce an error (by valid command syntax).
You are right. Personnally, I can not understand the usage for this. I would like to have an error instead of an empty return.
Thats why I did not find a bug for monthes. I wrote:
ttk::radiobutton ... -variable [namespace which -variable a(b)]
Clearly an error, but no error raised and it just does not work.
Thanks, Harald
Log in (anonymous is fine) to add a comment.