No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] Testing for execution inside object
From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Tue, 03 Oct 2006 13:55:41 +0200
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
Date: Tue, 03 Oct 2006 13:55:41 +0200
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