Tcl/Tk: Handling String Expressions

[ Thanks to Naheed
for this link. ]

“Tcl (Tool Command Language) is a scripting language
originally designed for embedded system platforms. Since its
creation, Tcl has grown far beyond its original design with
numerous expansions and additions (such as the graphical Took Kit
or Tk) to become a full-featured scripted programming language
capable of creating elegant, cross-platform solutions.


“When I first started using Tcl, everything I read or researched
stressed the mantra “Everything is a string”. Coming from a
hard-typed coding environment, I was used to declaring variable
types and in Tcl this was not needed. A set command could—and
still does—create the variable and assigns the type on the
fly. For example, set variable “7” and set variable 7 will both
create a variable containing 7. However, with Tcl, you can still
print the variable containing a numeric 7 and add 1 to the variable
containing a string representation of 7.

“It still holds true today that everything in Tcl is a string.
When we explore the TK Toolkit and widget creation, you will
rapidly see that widgets themselves have a set of string values
that determine their appearance and/or behavior.”

Complete Story