- unset ?-nocomplain? varName ?varName ...?
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: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:The following happens when you bind a variable to an entry widget through the -textvariable option and subsequently issue [unset textvariable] :
TV 24 apr '03 I just found behaviour I didn't get:
Did you know that an unset can appear to fail? Erik Leunissen wrote about this on comp.lang.tcl during Oct, 2002: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:The following happens when you bind a variable to an entry widget through the -textvariable option and subsequently issue [unset textvariable] :
- the textvariable may become unset for a fraction of a millisecond, I'm not sure. Perhaps somebody else can elaborate on this ...
- the textvariable binding will immediately reassign the value of the contents of the entry widget to the textvariable. (If it has been unset for a short moment, it is recreated)
- release the binding to the entry widget by:
- doing [ .entry -textvariable {} ], or
- destroying the widget entirely
- unset the variable: [unset textvariable]
- try to remember this issue (better than I do) when it takes you by surprise the next time.
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::defaultCharsetIts 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?TV: It would seem to be stable. Its the page content and url info etc array variable, which sticks around it seems until deleted, that's the whole reason I was looking for some garbage collection, or delayed freeing. It could be there is an event linked with some element, I don't know, I didn't write the at least handy http package...CHL: I don't know why, but it seems to happen when a variable in a namespace is defined but is not set. For instance...
1 % namespace eval nspace { variable novalue ; variable value 0 }
2 % info vars ::nspace::*
::nspace::value ::nspace::novalue
3 % unset ::nspace::novalue
can't unset "::nspace::novalue": no such variable
4 % info vars ::nspace::*
::nspace::valueTcl syntax help - Arts and crafts of Tcl-Tk programming - Category Command
