Because the history managment is written in Tcl itself, and that uses incr
.
Your incr
is almost equal to Tcl 8.3's incr
with some differences:
- The name of the variable is always printed
- If the variable does not exist, it will be created.
So if you remove the first difference (the puts
) everything will work as expected, just that some library commands may call your incr
instead the standard incr
.
The second difference is now in the core, IIRC starting with Tcl 8.5 it is not nessencary that a variable already exists pior to calling incr
.
In short: What you did is fine. But don't expect to be the only one who calls an standard command.