current3nx
Return information about the method callstack
Usage
current ?option?
Overview
current?option?-
This introspection command provides information about various details, to be identified using option, on the callstack. The command is invoked from a method body. If option is not provided,
nx::currentwill default to optionobject(see below).nx::currentoperates on the Tcl callstack and is aware of NX-specific callstack and stackframe details. Except for the optionscallinglevelandlevel, callingnx::currentoutside an NX object or method will result in an error. option can be any of the following:- •
-
activelevelreturns the actual callstack level which calls into the currently executing method directly. Thisactivelevelmight correspond thecallinglevel, but this is not necessarily the case. Theactivelevelalso includes intermediate calls, such asnx::nextinvocations. The level is reported as an absolute level number (# followed by a digit) to be directly used as the first argument touplevelorupvar.
- •
-
argsreturns the list of argument values passed into the currently executing method implementation.
- •
-
calledclassreturns the name of the class that provides the method implementation to which the intercepted method call is to be redirected (only available from within filter methods).
- •
-
calledmethodreturns the original method name requested by intercepted method call (only available from within filter methods).
- •
-
callingclassreturns the name of the class which provides the method implementation calling into the currently executing method. See alsocallingobject.
- •
-
callinglevelresolves the callstack level of the originating invocation of the currently executing method implementation. Callstack levels introduced by method interception (e.g., filters) and by method combination (nx::next) are ignored. The level is reported as an absolute level number (# followed by a digit) to be directly used as the first argument touplevelorupvar. See alsoactivelevel. If called outside NX,1is returned (which is the default forupvaranduplevel).
- •
-
callingobjectreturns the name of the object which is calling into the currently executing method. See alsocallingclass.
- •
-
classreturns the name of the class providing the currently executing method implementation. The returned method-providing class may be different to the class of the current object. If called from within a method implementation provided by the current object itself, an empty string is returned.
- •
-
filterregreturns the object (class) on which the currently executing method was registered as a filter method (only available from within filter methods).
- •
-
isnextcallwill return 1, if the currently executing method implementation was invoked vianx::next; 0 otherwise.
- •
-
levelwill return a number indicating the stack level of the currently executed method or script, or an empty string when executed outside an NX context (e.g., in a Tcl proc or a namespace script). The resulting value can be directly passed as level to info level.
- •
-
methodreturns the name of the currently executing method. If an ensemble-method call, the name of the bottom-most ("leaf") method is returned.
- •
-
methodpathreturns the combined name of the currently executing method (including all ensemble levels) in an ensemble-method call. Otherwise, for a regular method call, the result corresponds to the result of optionmethod.
- •
-
nextmethodreturns the name of the next most specific method implementation to be called when invokingnx::next.
- •
-
objectgives the name of the object on which the currently executing method implementation is evaluated.
Releases
5 releases since Debian 9 (Stretch); the text changed 3 times.