Consider the following code snippet:
package require snit
set a 1234
namespace eval b {
variable c 5678
}
snit::type a {
option -a -default $::a
}
snit::type b {
option -b -default $::b::c
}
Snit will claim for both option definitions that the variable is not readable:
e.g. for type a:
can't read "::a": no such variable
for type b:
can't read "::b::c": no such variable
The use case for this is to use a variable in Tcl in the same manner a #define is used in e.g. C
Workaround:
Options where this is desired can be initialized in the constructor for the type e.g.
snit::type a {
option -a
constructor args {
set options(-a) $::a
self configurelist $args
}
}
|