Some common mistakes when programming in Tcl/Tk

Purpose: gather references and tips regarding common Tcl programming pitfalls


  1. Cameron Laird has created http://phaseit.net/claird/comp.lang.tcl/fmm.html to document his version of Frequently Made Mistakes (FMM) in Tcl
  2. Is white space significant in Tcl? is another common question/problem.
  3. Quoting hell is another one
  4. Why can I not place unmatched braces in Tcl comments? is another of the common mistake/problems
  5. Recently in comp.lang.tcl, Darren New says: ... "You need to learn the difference between $address and address, and where each is appropriate.", then goes on to explain when one should use $variable_name and when one should use variable_name - some Tcl commands wants the name of a variable, while most want the value of a variable.
  6. Kevin Kenny declares: Update considered harmful
  7. Don't Do That! documents a variety of things that Tcl/Tk programmers should avoid doing.
  8. Tk image Dos and Don'ts documents a variety of image related things that Tk programmers should consider.
  9. Overinterpreting metacharacters: "" and {} are just for grouping - foo is "foo" is {foo}. Only at whitespaces and substitutions do they make a difference.
  10. Mike Hall writes in comp.lang.tcl "Never name your script file the same name as a widget class."
  11. AM A common mistake under UNIX/Linux: calling an executable (binary or script file) "test". This is not a Tcl problem - instead this item may not get executed since most command shells have an internal command "test" that is executed instead. However, if you use a full or partial path name (/path/to/test or ./test) it may work. Best approach is not to give it that name - just as you should not use the names of other built in commands (like cd, pwd, etc.)