Helmut Giese
2024-11-05 22:24:53 UTC
Hello out there,
currently Tk accepts only _gobal_ variables for widgets which set a
value. I always wondered why it doesn't also accept a fully namespaced
variable, too. Like so:
---
namespace eval ns {
variable someVar ""
}
ttk::radiobutton .rad -text "Some text" -variable ::ns::someVar
---
If one demanded that always either a global or a _fully namespaced_
variable had to be supplied it would not cause any ambiguities even
when the above call would have been inside the namespace where the
variable 'someVar' already is defined.
Tcl 9 is the opportunity to introduce incompatibilities - although I
wonder if this even IS an incompatibility: In Tcl 8 a syntax like
-var ::ns::someVar
is not illegal: it just doesn't have any effect while in Tcl 9 it
would. But this is probably a question of language semantics which I
am not qualified to judge.
Comments welcome
Helmut
currently Tk accepts only _gobal_ variables for widgets which set a
value. I always wondered why it doesn't also accept a fully namespaced
variable, too. Like so:
---
namespace eval ns {
variable someVar ""
}
ttk::radiobutton .rad -text "Some text" -variable ::ns::someVar
---
If one demanded that always either a global or a _fully namespaced_
variable had to be supplied it would not cause any ambiguities even
when the above call would have been inside the namespace where the
variable 'someVar' already is defined.
Tcl 9 is the opportunity to introduce incompatibilities - although I
wonder if this even IS an incompatibility: In Tcl 8 a syntax like
-var ::ns::someVar
is not illegal: it just doesn't have any effect while in Tcl 9 it
would. But this is probably a question of language semantics which I
am not qualified to judge.
Comments welcome
Helmut