How do I remove a Tcl procedure?

cfi picture cfi · Mar 27, 2012 · Viewed 7.5k times · Source

How do I remove a tcl procedure?

One can

  • unset a variable,
  • override an alias with interp alias {} myproc {} otherproc,
  • override a proc with one defined inside another namespace with namespace import -force.

But I did not find a way to make a procedure unknown.

Answer

TrojanName picture TrojanName · Mar 27, 2012

Use rename to delete a proc

rename myproc ""

Example:

% proc myproc {} {
    puts "hello world"
}
% myproc
hello world
% rename myproc ""
% myproc
invalid command name "myproc"
%