On 05/09/2019 09:30, Juge wrote:
> I did not try this out yet so maybe it would even work maybe not.
It almost works. You need to create the namespace before you can set
values in it, you need to use [variable] inside the using procedure, and
you need to use the fully qualified name inside [variable] to do what
you're after safely. In short, this works (with some shorter names to
make things fit nicely on a line):
namespace eval jans {}
namespace eval defaults {
variable ::jans::vardefelse "Success"
}
namespace eval jans {
proc printvar {} {
variable vardefelse
puts $vardefelse
}
}
jans::printvar; # ==> Success
Donal.
--
Donal Fellows — Tcl user, Tcl maintainer, TIP editor.