Re: interaction of global and rename



Paul Nash a écrit :

I am using configuration files where each item is a command using a
procedure [ps]
proc colorscheme scheme {
global Config
# redefine proc ps
if { [ info proc psold2] == {} } {rename ps psold2}
proc ps {tag options} {
...
}
...
}

Now [colorscheme] is executed in the context of a parent config file with a
line this:

ps -colorscheme [colorscheme greyblue]

Further, [colorscheme] is called before [ps] in this command.
(because of the rules of tcl)
The execution stack is :

- execute [colorscheme greyblue] which change the
body of [ps]
- replace this call by its return value
- execute the new ps via [ps -colorscheme <value>]

This may have unexpected side-effects.
Cheers,

Stéphane

.