Posted to tcl by sebres at Wed Jun 01 18:43:34 GMT 2022view raw

  1. # interp configure {} -var-resolver strict
  2. namespace eval ns { namespace configure -var-resolver smart;
  3. proc test {} {
  4. set .::var "var in [namespace current]";
  5. set ..::var "var in [namespace parent]";
  6. set var "local var by setter";
  7. local lvar; # resolving local by following getter and setter
  8. nsvar anyvar; # resolving by availability (.:: -> ..:: -> ... -> ::) by following getter and setter
  9. const anyconst; # resolving by availability (local -> .:: -> ..:: -> ... -> ::) by getter (and local scope by declaration)
  10. set somevar; # resolving by availability (local -> .:: -> ..:: -> ... -> ::) by getter only (if not declared as local/nsvar)
  11. }
  12. }
  13.