Posted to tcl by sebres at Wed Jun 01 18:43:34 GMT 2022view raw
- # interp configure {} -var-resolver strict
- namespace eval ns { namespace configure -var-resolver smart;
- proc test {} {
- set .::var "var in [namespace current]";
- set ..::var "var in [namespace parent]";
- set var "local var by setter";
- local lvar; # resolving local by following getter and setter
- nsvar anyvar; # resolving by availability (.:: -> ..:: -> ... -> ::) by following getter and setter
- const anyconst; # resolving by availability (local -> .:: -> ..:: -> ... -> ::) by getter (and local scope by declaration)
- set somevar; # resolving by availability (local -> .:: -> ..:: -> ... -> ::) by getter only (if not declared as local/nsvar)
- }
- }