Artifacts Associated With Ticket 472113
Ticket change [1d76cb422d] (rid 90813) by hartweg on 2001-10-17 15:41:42:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
[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:
- foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "hartweg"
- subsystem initialized to: "None"
- title initialized to: "[namespace which -var] fails for ary(i)"
- type initialized to: "Bug"
Ticket change [749c765d88] (rid 105234) by hartweg on 2001-10-17 22:58:23:
- icomment:
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]" } - login: "hartweg"
- mimetype: "text/plain"
- username: "hartweg"
- icomment:
Ticket change [61b4951670] (rid 92288) by hartweg on 2001-10-17 23:01:20:
- subsystem changed to: "21. [namespace]"
Ticket change [438784ac6b] (rid 116569) by dgp on 2002-01-15 20:14:45:
- assignee changed to: "msofer"
Ticket change [192fc9eae5] (rid 122775) by msofer on 2002-08-08 03:13:25:
- icomment:
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.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [1b793a1123] (rid 123158) by dgp on 2003-11-13 08:36:13:
- foundin changed to: "obsolete: 8.4a3"
Ticket change [4b75ce7546] (rid 126716) by msofer on 2006-10-01 22:07:23:
- icomment:
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.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [31e27e657d] (rid 93513) by msofer on 2009-05-01 08:30:08:
- priority changed to: "6"
Ticket change [15f940948a] (rid 153752) by oehhar on 2017-05-15 11:46:42:
- closer changed to: "nobody"
- comment changed to:
[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:
- icomment:
Miquel Sofer wrote: <verbatim> (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? </verbatim> Let me express my expectation. <b>[namespace which -variable ary(k)]</b> 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 <b>[namespace which -variable ary](k)</b>. 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.
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- severity changed to: "Minor"
- username: "oehhar"
Ticket change [20681b4ae0] (rid 153753) by sebres on 2017-05-15 17:56:00:
- icomment:
<blockquote>check if it is an array. If not -> error</blockquote> I 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: <pre> unset -nocomplain novar namespace which -variable novar </pre>
- login: "sebres"
- mimetype: "text/html"
- icomment:
Ticket change [529616e502] (rid 153771) by oehhar on 2017-05-16 07:18:48:
- icomment:
Sebres wrote: <verbatim> I guess, it should rather return "" in this case, because currently "namespace which" will never produce an error (by valid command syntax). </verbatim> 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: <verbatim> ttk::radiobutton ... -variable [namespace which -variable a(b)] </verbatim> Clearly an error, but no error raised and it just does not work. Thanks, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment: