This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

remove proc

Help for those learning Tcl or writing their own scripts.
Post Reply
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

remove proc

Post by Ofloo »

hi, i'm wondering if it would be possible to delete a proc without restarting your script..

like..

Code: Select all

proc test {} {return 0} ;# proc is created now how to delete it?
I've been thinking of a way to do this but I can't think of any, is it even possible, ..
XplaiN but think of me as stupid
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

I don't know of any way to 'unset' a proc but you could simply overwrite it with a proc of the same name accepting the same number of arguments that simply returns zero (ie. does nothing). Not exactly elegant, but functional in most circumstances I would have thought.

The only problems i envisage is if you use the command [info procs ?pattern?] elsewhere in your code because the proc would still exist, or perhaps if you are deliberately trying to generate and catch an error if the proc doesn't exist.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Simply use the rename command. Renaming a proc to an empty string will delete the function and/or proc.
NML_375
Post Reply