You only need curly braces...

Unlike some languages which require curly braces to delimit blocks of code, in Tcl curly braces are always optional. While this is a fundamental feature of how the Tcl parser works [1], few if any books and tutorials actually spell it out. My way to describe this is with the following rule:

You only need curly braces when you need curly braces

What usually happens is that a new programmer is taught "here's how to do if: if {condition} {body}", or "here's how to create a proc: proc name {args} {body}". While it is true that those are both the best way to create conditions or procs, it remains true that the curly braces are entirely optional.

This brings me to another simple statement I use to describe Tcl quoting:

Quoting is a tool, not a rule

So what does all that mean?

It means that you should use curly braces whenever you need them to get the quoting behavior you desire. There is nothing in the Tcl language specification that requires curly braces in any situation. We teach their use according to best practices but they are just that - best practices. Whenever you find a situation where curly braces don't give you the proper behavior, switch to something else. It's that simple.

A practical example

There's hardly a week that goes by that someone doesn't post to comp.lang.tcl some variation of the following question:

From: Tcl Newbie
Subject: Help!!!
Newsgroups: comp.lang.tcl

When I press the button it always has the last value of $i. 
How do I get it to have the value of the button??????

  for {set i 0} {$i < 10} {incr i} {
    button .b$i -command {doSomething $i}
  }

Knowing what you now know about quoting, doesn't the answer just jump out at you?

In this case we need $i to be substituted inside the loop rather than when the button is clicked. Thus, we don't want to use curly braces because they don't give us the quoting behavior we desire. The answer to the above problem is simple: use some other form of quoting than curly braces.

If you can remember that "quoting is a tool, not a rule" and "you only need curly braces when you need curly braces" you're well on your way to never having a quoting problem again.

References

  1. Tcl 8.4 language syntax summary man page - http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm