stdout redirection

If you are using Tcl 8.6, you can trap all the output to stdout by adding a suitable transform via chan push: # Use a class to simplify the capture code oo::class create CapturingTransform { variable var constructor {varName} { # Make an alias from the instance variable to the global variable my eval [list … Read more

Why do Tcler suggest to brace your `expr`essions?

The “problem” with expr is that it implements its own “mini language”, which includes, among other things, variable substitution (replacing those $a-s with their values) and command substitution (replacing those [command …] things with the results of running commands), so basically the process of evaluating expr $a + $b goes like this: The Tcl interpreter … Read more