1rename(n)                    Tcl Built-In Commands                   rename(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       rename - Rename or delete a command
9

SYNOPSIS

11       rename oldName newName
12_________________________________________________________________
13
14

DESCRIPTION

16       Rename  the  command  that  used to be called oldName so that it is now
17       called newName.  If newName is an empty string then oldName is deleted.
18       oldName and newName may include namespace qualifiers (names of containā€
19       ing namespaces).  If a command is renamed into a  different  namespace,
20       future invocations of it will execute in the new namespace.  The rename
21       command returns an empty string as result.
22

EXAMPLE

24       The rename command can be used to wrap the standard Tcl  commands  with
25       your  own  monitoring  machinery.  For example, you might wish to count
26       how often the source command is called:
27              rename ::source ::theRealSource
28              set sourceCount 0
29              proc ::source args {
30                  global sourceCount
31                  puts "called source for the [incr sourceCount]'th time"
32                  uplevel 1 ::theRealSource $args
33              }
34
35

SEE ALSO

37       namespace(n), proc(n)
38
39

KEYWORDS

41       command, delete, namespace, rename
42
43
44
45Tcl                                                                  rename(n)
Impressum