http://www.purl.org/tcl/home/man/tcl8.4/TclCmd/unset.htm
Note that you should use a catch with unset if there is a chance that a variable being unset hasn't been created yet.
Did you know that an unset can appear to fail? Erik Leunissen wrote about this on comp.lang.tcl during Oct, 2002: It is an error for the variables to not already exist, the name to be illegal, Well, I've been bitten by this one on a *regular* basis, but not on a *frequent* basis. So infrequently, that I tend to forget about the issue, and once it happens again, it takes me by surprise and I need hours to find the cause of evil, which I'll explain: A trace on the variable can resurrect it. The following happens when you bind a variable to an entry widget through the -textvariable option and subsequently issue [unset textvariable] : DKF: In 8.6, unset is bytecode compiled. (And don't use `catch
So what's the recipe then? In retrospect, unset should have been designed so that it was not an error to
For the coming releases of Tcl (still in CVS), you can also set an unset trace on the textvariable, and let the trace handler do the above step one and/or two. For current releases this will not yet work because of a (recently fixed) bug.
TV 24 apr '03 I just found behaviour I didn't get:
(Tcl) 68 % info var http::* ::http::urlTypes ::http::http ::http::1 ::http::alphanumeric ::http::encodings ::http::formMap ::http::defaultCharset (Tcl) 68 % unset ::http::1 can't unset "::http::1": no such variable (Tcl) 69 % info var http::* ::http::urlTypes ::http::http ::http::alphanumeric ::http::encodings ::http::formMap ::http::defaultCharset
proc test {n cmd} { Its wish 8.4.1, and it runs bwise, a webserver (tclhttpd with some alterations), and this is clearly from the http package to fetch a webpage. Maybe the manual gives a neat answer, I just found it noteworthy that a unset in error still seems to do it's unsetting.
RS: ..or that the variable was removed by the web server between the first two commands? What happens if you just call the first command repeatedly?
Tcl syntax help - Arts and crafts of Tcl-Tk programming - Category Command