Getting started with tcl
Remarks#
Tcl is a cross platform language with full unicode support.
Flexibility: redefine or enhance existing commands or write new commands.
Event driven programming: Event driven I/O and variable tracing.
Library Interface: It is very easy to integrate existing C libraries into Tcl and provide a Tcl interface to the C library. These interface “stubs” are not tied to any particular version of Tcl and will continue to work even after upgrading Tcl.
Tcl Interface: Tcl provides a complete API so you use the Tcl interpreter from within your C/Python/Ruby/Java/R program.
Versions#
Version | Notes | Release Date |
---|---|---|
8.6.6 | Current Patch Release. | 2016-07-27 |
8.6.5 | 2016-02-29 | |
8.6.4 | 2015-03-12 | |
8.6.3 | 2014-11-12 | |
8.6.2 | 2014-08-27 | |
8.6.1 | 2013-09-20 | |
8.6.0 | Current recommended version series for new code. Introduced object system and non-recursive execution engine. | 2013-09-20 |
8.5.19 | Current LTS release | 2016-02-12 |
8.5.18 | 2015-03-06 | |
8.5.17 | 2014-10-25 | |
8.5.16 | 2014-08-25 | |
8.5.15 | 2013-09-18 | |
8.5.14 | 2013-04-03 | |
8.5.13 | 2012-11-12 | |
8.5.12 | 2012-07-27 | |
8.5.11 | 2011-11-04 | |
8.5.10 | 2011-06-24 | |
8.5.9 | 2010-09-08 | |
8.5.8 | 2009-11-16 | |
8.5.7 | 2009-04-15 | |
8.5.6 | 2008-12-23 | |
8.5.5 | 2008-10-15 | |
8.5.4 | 2008-08-15 | |
8.5.3 | 2008-06-30 | |
8.5.2 | 2008-03-28 | |
8.5.1 | 2008-02-05 | |
8.5.0 | Current oldest supported version. Introduced expansion syntax, dictionaries and ensemble commands. | 2007-12-20 |
8.4.20 | Final 8.4 series release. There will be no further releases of 8.4. | 2013-06-01 |
8.4.19 | 2008-04-18 | |
8.4.18 | 2008-02-08 | |
8.4.17 | 2008-01-04 | |
8.4.16 | 2007-09-21 | |
8.4.15 | 2007-05-25 | |
8.4.14 | 2006-10-19 | |
8.4.13 | 2006-04-19 | |
8.4.12 | 2005-12-03 | |
8.4.11 | 2005-06-28 | |
8.4.10 | 2005-06-04 | |
8.4.9 | 2004-12-07 | |
8.4.8 | 2004-11-22 | |
8.4.7 | 2004-07-25 | |
8.4.6 | 2004-03-01 | |
8.4.5 | 2003-11-24 | |
8.4.4 | 2003-07-22 | |
8.4.3 | 2003-05-19 | |
8.4.2 | 2003-03-03 | |
8.4.1 | 2002-10-22 | |
8.4.0 | First release by Tcl Core Team. Many performance enhancements. Improved 64-bit support. | 2002-09-18 |
8.3.5 | 2002-10-18 | |
8.3.4 | 2001-10-19 | |
8.3.3 | 2001-04-06 | |
8.3.2 | 2000-08-09 | |
8.3.1 | 2000-04-26 | |
8.3.0 | Performance improvements. | 2000-02-10 |
8.2 | Stabilisation release | 1999-08-18 |
8.1 | Introduced Unicode support. | 1999-04-30 |
8.0 | Introduced bytecode compilation engine | 1997-08-16 |
Installation
Installing Tcl 8.6.4 on Windows :
-
The easiest way to get Tcl on a windows machine is to install the ActiveTcl distribution from ActiveState.
-
Navigate to www.activestate.com and follow the links to download the Free Community Edition of ActiveTcl for Windows (choose 32/64 bit version appropriately).
-
Run the installer which will result in a fresh install of ActiveTcl usually in the C:\Tcl directory.
-
Open a command prompt to test the install, type in “tclsh” which should open an interactive tcl console. Enter “info patchlevel” to check the version of tcl that was installed and it should display an output of the form “8.6.x” depending on the edition of ActiveTcl that has been downloaded.
-
You may also want to add “C:\Tcl\bin” or its equivalent to your environment PATH variable.
C:>tclsh % info patchlevel 8.6.4
The Hello, world program in Tcl (and Tk)
The following code can be entered in a Tcl shell (tclsh
),
or into a script file and run through a Tcl shell:
puts "Hello, world!"
It gives the string argument Hello, world!
to the command puts
. The puts
command writes its argument to standard out (your terminal in interactive mode) and adds a newline afterwards.
In a Tk-enabled shell, this variation can be used:
pack [button .b -text "Hello, world!" -command exit]
It creates a graphic button with the text Hello, world!
and adds it to the application window. When pressed,
the application exits.
A Tk-enabled shell is started as: wish
Or using tclsh
along with the following statement:
package require Tk
Features of Tcl
- Cross Platform Portability
- Runs on Windows, Mac OS X, Linux, and virtually every variant of unix.
- Event driven programming
- Trigger events based on variable read / write / unset.
- Trigger events when a command is entered or left.
- Trigger events when a I/O channel (file or network) becomes readable / writable.
- Create your own events.
- Trigger a command based on a timer.
- Object Oriented Programming
- Mixins.
- Superclasses and subclasses.
- Simple Grammar
- Full unicode support
- It just works. No special commands are needed to handle unicode strings.
- Convert to and from different encoding systems with ease.
- Flexible
- Create new control structures and commands.
- Access variables in the calling procedure’s context.
- Execute code in the calling procedure’s context.
- Powerful introspection capabilities.
- Many Tcl debuggers have been written in Tcl.
- Library interface
- Integrate existing C libraries and provide a Tcl interface to the library.
- Library “stubs” are not tied to any particular version of Tcl and will still work after a Tcl upgrade.
- Complete API
- Embed a Tcl interpreter into your favorite language.
- Python, Ruby, R, Java and others include a Tcl API.
- Embedded bigint library.
- No special actions are needed to handle very large numerics.
- Safe interpreters
- Create sandboxes in which user code can be run.
- Enable and disable specific commands for the interpreter.
- Regular Expressions
- A powerful and fast regular expression engine written by Henry Spencer (creator of regex).
Installing packages through teacup
Now days many languages are supporting archive server to install their packages into your local machine. TCL also having same archive server we called it as Teacup
teacup version
teacup search <packageName>
Example
teacup install Expect