Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove a Tcl procedure?

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.

like image 789
cfi Avatar asked Mar 27 '12 11:03

cfi


People also ask

What is Tcl procedure?

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.

What is PROC command in Tcl?

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.


1 Answers

Use rename to delete a proc

rename myproc ""

Example:

% proc myproc {} {
    puts "hello world"
}
% myproc
hello world
% rename myproc ""
% myproc
invalid command name "myproc"
%
like image 159
TrojanName Avatar answered Dec 19 '22 13:12

TrojanName