Re: tcl-trace
- From: "Paul" <diptansu@xxxxxxxxx>
- Date: 28 Nov 2006 07:07:44 -0800
I am a noob, so please forgive me if I am wrong.
It seems to me that this is what's happening:
proc testeTclTrace {} {
puts "[info level 0] Tcl$::tcl_patchLevel"
set ::a 0 -- value of ::a == 0
proc ::trc {args} { puts " [info level 0] a = [set ::a]" }
trace add variable ::a {write unset} "::trc" -- trace setup on ::a
incr ::a -- ::a incremented to 1, then the trace kicks in and calls ::trc which prints the value of ::a, i.e. 1
trace add variable ::a {write unset} "::trc"
incr ::a -- exactly similar to above, only this time ::a is incremented to 2 and then printed.
trace add variable ::a {write unset} "::trc"
unset ::a -- the trace kicks in before the variable is unset, so it still has a value, i.e. 2. So 2 gets printed.
}
There are others far smarter than me who can doubtless find holes in
this explanation.
Cheers,
Diptansu
.
- References:
- tcl-trace
- From: Florian . Murr
- tcl-trace
- Prev by Date: Re: Is there a way to make 'wish' read standard input?
- Next by Date: Re: Working example of ncgi usage
- Previous by thread: tcl-trace
- Next by thread: Re: tcl-trace
- Index(es):
Relevant Pages
|