gaz...@shell.xmission.com (Kenny McCormack) writes:
> I found that the way to remove a proc definition is to rename it to "",
> like this:
> [...]
> I note that you can't rename it back (rename "" foo fails), so it does
> seems like it really does just disappear, but I'm still curious about it -
> hence this post.
>
> Does the rename command recognize "" as a magic string, that causes the
> proc to be really deallocated?
To entertain you aside the reference to the documentation you already
got:
It is possible in Tcl that the empty string is a command.
proc {} {} {
puts "Called"
}
Call it with
""
or
{}
If you rename this proc to the empty string ("") - the name it already
has - then it will of course vanish.
rename "" ""
Now you can't call "" anymore.
Another corollary: All other commands can be renamend - to replace them
with another one for a while, for example - and can later renamed back
to its original name. This is not possible for a command with the empty
string as name. If you rename it from it original name, you have to
redefine it with proc.