Tcl, portable and graphics scripts
The language is used for scripting and prototyping. It may be a replacement for Perl, as CGI for web services. The language and the graphical toolkit are ported on almost all operating systems and they may be used for the advantage of portability.
Tcl, Tool Command Language (pronounce tickle) was created by John
Ousterhout in 1988. The graphical toolkit Tk has been available in
1991.
This is an interpreted scripting language, easy to learn where each
thing is a command and can be redefined. The syntax uses plenty of
symbols as C but is not that of C. In C each thing is an expression. It had event loop long before JavaScript.
Although it can be interfaced along with the Tk graphical framework, to all programming languages, especially C and Python (Tkinter), it has lost its interest over time, for not being updated to be adapted to modern applications.
Tk does not have a declarative user interface language such as QML (Qt), XAML or even HTML 5, XML layouts in Android, which seems indispensable today, as evidenced for Java by the abandonment of JavaFX Script, another procedural interface language as Tk, ditched for JavaFX, a declarative language of interface.
Tcl was supported for a time by Sun, which has contributed to its development. Then Sun decided to focus on Java and maintaining the interpreter was transmitted to an independent company, Scriptics. Later it was sold and the buyer having no interest in the language, he has had no more development instead of competing languages like Python and Ruby. Moreover, Tk which was also a part of its interest has been eclipsed by GTK and Qt.
This has been highlighted in the article Where Tcl/Tk were wrong, a history and analysis of the language, and a comparison with other GUI tools.
Tcl/k has still an active community, but has no great future because of the competition in the field of scripting by new languages like Go, and even JavaScript which moves to command line with Node.js. There is nothing in Tcl/Tk that we can not do with Node, JavaScript and Canvas.
The Little language, has been developed to be compatible with Tcl code and its graphical kit while offering a more readble C-like syntax.
Syntax and examples of a command language
An instruction is the name of a command (not a keyword) followed by
a list of words separated by a whitespace, the parameters.
Statements end with the end of the line. They may be separated by a
semi-colon on a same line.
Square brackets replace an argument by a command. These are so
a substitution symbols.
The = sign is never used, the "set" command assigns a value to a variable:
set varname value
Example:
set x 8
But a $ symbol will be needed before the variable's name to reference it (that is not the case for arrays):
puts $x
The { } serve for grouping, without subsitution.
# introduces a comment.
Control structures:
The if command use two groups { }, the first for the condition, the second for the actions.
if { $x < 10 } {
puts "x less than 10"
}
The while command has the same syntax.
Procedures:
The definition starts with the proc command, plus the name and two groups for the arguments and the statements.
proc procname { arguments } {
...statements...
}
Examples of code:
Displaying "Hello world!".
puts "Hello, world!"
Scanning the content of an array.
array set mylist { d e m o }
foreach i [ array get mylist ] {
puts [ concat $i = mylist($i) ]
}
References: John K. Ousterhout, Tcl and the Tk Toolkit, Addison-Wesley.
See the official site, Tcl/Tk.