Version 0 of The way tcl works

Updated 2004-11-05 09:10:50

The way tcl works

from "Bryan's Practical Guide to Tcl Programming", vol 0, page 0.

    The way tcl works: a line of code is parsed once. Only 
    once. Only ever once. Once, once, once. No exceptions at
    all. None. Zero. Zip. Nada. After substitutions are performed
    the first word becomes the command and all the other words 
    become the arguments. Always. Always, always. Always. 

    Always.

    To avoid substitutions, place a \ before special characters, 
    or place a whole string of special characters inside curly 
    braces. Things in curly braces will never, ever, ever, ever 
    be parsed before being passed to the command. Never, ever,
    ever. No exceptions. 

    The only tricky part (the _only_ tricky part) is knowing 
    that some commands will do their own parsing of arguments.
    But only *after* the line of code is parsed in the usual
    manner. Examples of these commands are "if", "expr", 
    "while" and a few others. 

    Unless you know for certain what you are doing, and know 
    for a fact that you want something to potentially be 
    evaluated twice, always, always, always provide such 
    arguments in curly braces. Always. Unless you know what 
    precisely what you are doing.

    When you truly understand the above, you are a tcl expert.

Reference: [L1 ]