[Xotcl] Testing for execution inside object
Gustaf Neumann
neumann at wu-wien.ac.at
Tue Oct 3 13:55:41 CEST 2006
Kristoffer Lawson schrieb:
> I need to know if the current procedural context is inside a method
> (isntproc, proc, whatever) or not.
can you explain in more detail, what the problem is?
Note, that one can calls tcl procs from within xotcl methods, one can
have evals, uplevels, etc.
> What is the best way to do this? I used [self] to check by catching
> the error, but that doesn't work particularly well if another package
> happens to define the command [self].
use ::xotcl::self
"self" can be used to check whether the xotcl callstack is non-empty.
without promising to much, a sucommand"ismethod" for "self" retuning 0
or 1 depending whether the
current stackframe is an xotcl method should be doable with little effort.
-gustaf
More information about the Xotcl
mailing list