Index: doc/Object.man =================================================================== diff -u -rf52d344b772763bfd59bc41294e7a45a336b2346 -r63ef94e81bbdfb6c0c233d65520a3e7b3e47f706 --- doc/Object.man (.../Object.man) (revision f52d344b772763bfd59bc41294e7a45a336b2346) +++ doc/Object.man (.../Object.man) (revision 63ef94e81bbdfb6c0c233d65520a3e7b3e47f706) @@ -20,7 +20,7 @@ [vset CMD "obj"] [vset MODIFIER "object"] -[copyright {2014-16 Stefan Sobernig , Gustaf Neumann ; available under the Creative Commons Attribution 3.0 Austria license (CC BY 3.0 AT).}] +[copyright {2014-19 Stefan Sobernig , Gustaf Neumann ; available under the Creative Commons Attribution 3.0 Austria license (CC BY 3.0 AT).}] [moddesc "NX API"] [titledesc {API reference of the base class in the NX object system}] @@ -743,6 +743,55 @@ [list_end] +[cmd_def uplevel] + +[list_begin definitions] + +[call [arg obj] [method uplevel] [opt [arg level]] [arg arg1] [opt "[arg arg2] ..."]] + +Evaluate a script or a command at a different stack-frame +level. Behaves like Tcl's [cmd uplevel], with the following +important exceptions. + +[list_begin itemized] + +[item] If the [arg level] specifier is omitted, [method "uplevel"] +will skip any auxiliary frames added to the stack by active [term "filter"]s and +[term "mixin"]s. + +[item] If the [arg level] specifier is omitted, [method uplevel] gives +preference to the innermost frame corresponding to a proc, method, or +apply call. Any frames inbetween, incl. those of filters +and mixins (see above), will be skipped. + +[item] If the [arg level] specifier is provided (relative, or +absolute), [method "uplevel"] will move execution into the requested +stack-frame level (incl. those introduced by active active [term "filter"]s and +[term "mixin"]s), if valid. + +[list_end] + +[example { + % nx::Object create ::obj + % ::obj public object method foo {varName} { + :uplevel set $varName 1; return + } + ::obj + % namespace eval ::ns1 { + ::obj foo BAR + } + % namespace eval ::ns1 { + info exists BAR + } + 1 +}] + +[list_end] + +Note, in the example above, [method "uplevel"] is guaranteed to +resolve to the calling context of [method "foo"] ([term "ns1"]) despite +mixins and filters being (potentially) registered on [cmd "obj"]. + [cmd_def variable] [list_begin definitions]