How do I remove a tcl procedure?
One can
unset
a variable, interp alias {} myproc {} otherproc
,namespace import -force
. But I did not find a way to make a procedure unknown.
Procedures are nothing but code blocks with series of commands that provide a specific reusable functionality. It is used to avoid same code being repeated in multiple locations. Procedures are equivalent to the functions used in many programming languages and are made available in Tcl with the help of proc command.
The proc command creates a new Tcl procedure named name, replacing any existing command or procedure there may have been by that name. Whenever the new command is invoked, the contents of body will be executed by the Tcl interpreter. Args specifies the formal arguments to the procedure.
Use rename
to delete a proc
rename myproc ""
Example:
% proc myproc {} {
puts "hello world"
}
% myproc
hello world
% rename myproc ""
% myproc
invalid command name "myproc"
%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With