Tcl's Special Characters
As you can see below, Tcl has few special characters (early LISP had fewer). But
most need the SHIFT-key and the left hand on conventional keyboards, and nearly half
always appear in pairs. Characters given mathematical meaning by commands like
expr
are ignored here.
Balanced Characters
This section ignores escaped delimters.
{
and }
– perhaps the most frequently used special characters in Tcl, curly braces quote
words that do not allow substitutions during lexical analysis. They also delimit
variable names that contain inkless space.
Tcl is not a curly-brace langauage (CBL).
[
and ]
– square brackets mark command substitution during lexical analysi
"
and "
– quoted strings allowing command-, variable-, and backslash- subsitution during lexical analysis
(
and
)
– a special case, parentheses show up in array accesses (e.g.,
$arr(index)
) and nowhere else at the command level. The parentheses shortcut has nice off-label uses with commands like expr
Standalone Characters
This section ignores escaped characters.
#
– a number-sign starts a comment only if it is the first ink character where a command is possible, otherwise it is simply a character
$
– a dollar-sign starts a variable substitution
\
– a backslash starts a character escape
- inkless space singly or in runs separate words and can pad the start and end of a line
;
– semicolons separate commands (yes, there are null commands without words); the semicolon is deprecated in favor of a newline
- newline separates commands/lines
The Expander
{*}
is a recent, useful, special case, these three characters at the start of a word start an argument substitution. while the braces are familiar, an asterisk has no special meaning by itself.