Re: Tcl C extn - Scoping in extended cmds - how to?
- From: Alexandre Ferrieux <alexandre.ferrieux@xxxxxxxxx>
- Date: Thu, 28 Jun 2007 21:02:34 -0000
On Jun 28, 12:46 pm, "MartinLemburg@UGS" <martin.lemburg....@xxxxxxx>
wrote:
so far as I know, no tcl command (C function registered as tcl
command) creates a call-stack-scope on its execution.
On the contrary, every proc starts by creating a stack frame. Only
certain specific ones (like control structures) immediately pop back
from it through [uplevel].
If you need just that fresh frame and nothing else:
proc separate_frame __code {eval $__code}
set x 1
separate_frame {
set x 2
puts $x
}
puts $x
=>
2
1
I guess the OP could generalize this to his domain, with procs doing
real things in addition to the frame.
Now as to whether such style should be encouraged, I'm tempted to
agree with you.
But I'll leave it to the OP to decide if it makes sense in his problem
domain.
-Alex
.
- Follow-Ups:
- Re: Tcl C extn - Scoping in extended cmds - how to?
- From: arijit79
- Re: Tcl C extn - Scoping in extended cmds - how to?
- References:
- Tcl C extn - Scoping in extended cmds - how to?
- From: arijit79
- Re: Tcl C extn - Scoping in extended cmds - how to?
- From: MartinLemburg@UGS
- Tcl C extn - Scoping in extended cmds - how to?
- Prev by Date: Re: Launching Tkcon with a main script and another as arguments
- Next by Date: Re: top level windows query
- Previous by thread: Re: Tcl C extn - Scoping in extended cmds - how to?
- Next by thread: Re: Tcl C extn - Scoping in extended cmds - how to?
- Index(es):
Relevant Pages
|