Tcl

Tcl

Infobox programming language
name = Tcl

paradigm = multi-paradigm: object-oriented, functional, procedural, event-driven programming
year = 1988
designer = John Ousterhout
developer = John Ousterhout
latest_release_version = 8.5.4
latest_release_date = release date|2008|08|15
typing = dynamic typing, everything can be treated as a string
implementations = ActiveTcl
dialects =
influenced_by =
influenced = PowerShell [ [http://blogs.msdn.com/powershell/archive/2008/05/25/powershell-and-wpf-wtf.aspx Windows PowerShell : PowerShell and WPF: WTF ] ]
website = http://www.tcl.tk

Tcl (originally from "Tool Command Language", but nonetheless conventionally rendered as "Tcl" rather than "TCL"; pronounced as "" or "tee-cee-ell" ["From the Tcler's Wiki [http://wiki.tcl.tk/11902 Tcl vs. TCL] "] ) is a scripting language created by John Ousterhout. Originally "born out of frustration" [From the inside flap of "Tcl and the Tk Toolkit", ISBN 0-201-63337-X] —according to the author—with programmers devising their own (poor quality) languages intended to be embedded into applications, Tcl quickly gained wide acceptance on its own and is generally thought to be easy to learn [cite book |last=Flynt |first=Clif |title="Tcl/Tk - A developer's guide" |origyear=2003 |edition=First edition |publisher=Morgan Kaufmann Publishers |isbn=1-55860-802-8 |pages=759 ] , but powerful in competent hands. It is most commonly used for rapid prototyping, scripted applications, GUIs and testing. Tcl is used extensively on embedded systems platforms, both in its full form and in several other small-footprinted versions. Tcl is also used for CGI scripting and as the scripting language for eggdrop bots.

The combination of Tcl and the Tk GUI toolkit is referred to as Tcl/Tk.

History

The Tcl programming language was created in the spring of 1988 by John Ousterhout while working at the University of California, Berkeley.

Tcl conferences and workshops are held in both the United States and Europe.

Features

Tcl's features include:

* Everything is a command, including language structures. They are in Prefix notation.
* Commands can be variadic.
* Everything can be dynamically redefined and overridden.
* All data types can be manipulated as strings, including code.
* Extremely simple syntactic rules.
* Event-driven interface to sockets and files. Time-based and user-defined events are also possible.
* Flexible scope, with variable visibility restricted to lexical (static) scope by default, but uplevel and upvar allowing procs to interact with the enclosing functions' scopes.
* Simple exception handling using exception code returned by all command executions.
* All commands defined by Tcl itself generate informative error messages on incorrect usage.
* Readily extensible, via C, C++, Java, and Tcl.
* Interpreted language using bytecode for improved speed whilst maintaining dynamic modifiability
* Full Unicode (3.1) support, first released 1999.
* Platform independent: Win32, UNIX, Linux, Mac, etc.
* Close integration with windowing (GUI) interface Tk.
* Easy to maintain code. Tcl scripts are often more compact and readable than functionally equivalent code in other languages.Fact|date=September 2008
* Can be used for many purposes, and in many environments: as a text-only scripted language, as a GUI-capable language for applications, as an embedded language in: web pages (server-side; or client-side, as Tclets), and databases (server-side, in PostgreSQL).
* Exists as development version (e. g. ActiveState Tcl), as tclkit (kind of runtime version, only about 1 megabyte in size), as starpack (single-file executable of a script/program), as BSD licensed freely distributable source

Tcl did not originally support object oriented syntax, being a functional language, but recent versions do support extensions which provide OO functionality, such as the XOTcl extension to Tcl. Other OO extensions also exist, such as incr Tcl, Snit, and STOOOP (simple tcl-only object-oriented programming).

Syntax

A Tcl script consists of several commands. A command is a list of words separated by whitespace.

word0 word1 word2 ... wordN

The first word is the name of a command, which is not built into the language, but which is in the library. The following words are arguments. So we have:

commandName argument1 argument2 ... argumentN

Practical example, using the "puts" command which outputs a string, adding a trailing newline, by default to the "stdout" channel:

puts "Hello, world!"

Any argument may be replaced by another command in square brackets. The subcommand is evaluated first and the result is substituted as the argument. Alternatively, any argument placed in curly braces will not be evaluated, but rather will be handed directly back to the original command as an argument.

To summarize: there is one basic construct (the command) and a set of simple substitution rules, and only the square brackets, the curly braces, quotes, and the backslash have special meaning. The single equality sign (=) for example is not used at all, and the double equality sign (=) is the test for equality, and even then only in expression contexts such as the expr command or the first argument to if.

All commands have the same structure: a keyword which is followed by several parameters. A command is terminated by a newline or a semicolon. Even comments are just commands which happen to do nothing.

Tcl is not statically typed: each variable may contain integers, floats, strings, lists or any other value.

Interfacing with other languages

Tcl interfaces natively with the C language.

C++ Interoperability

Java Interoperability

Extension packages

The Tcl language has always supported extension packages, which provide additional functionality (such as a GUI, terminal-based application automation, database access, etc.)

Tk

The most popular Tcl extension is the Tk toolkit, which provides a graphical user interface library for a variety of operating systems. Each GUI consists of one or more "frames". Each frame has a layout manager.

Tile/Ttk

Tile/Ttk is a styles and theming widget collection which can replace most of the widgets in Tk with variants which are truly platform native through calls to an operating system's API. Themes covered in this way are Windows XP, Windows Classic, Qt (which hooks into the X11 KDE environment libraries) and Aqua (Mac OS X). A theme can also be constructed without these calls using widget definitions supplemented with image pixmaps. Themes created this way include Classic Tk, Step, Alt/Revitalized, Plastik and Keramik.

Under Tcl 8.4, this package is known as Tile, while in Tcl 8.5 it is included in the core distribution as Ttk.

Itcl/IncrTcl

Itcl is an object system for Tcl, and is normally named as [incr Tcl] (that being the way to increment in Tcl, similar in fashion to the name C++).

Tcllib

Tcllib is a set of scripted packages for Tcl that can be used with no compilation steps.

Databases

A number of database extensions are available:
* tclodbc
* mk4tcl
* SQLite
* Pgtcl, pgintcl
* mysqltcl, msqltcl
* AdabasTcl
* FBSQL
* ibtcl
* Oratcl
* Sybtcl
* db2tcland many, many others - see the [http://wiki.tcl.tk/620 Tcl/Tk Wiki] , specifically the [http://wiki.tcl.tk/_ref/3114 Tcl/Tk Wiki Database Category] .

See also

* Eggdrop
* Expect
* Itcl
* Itk
* Snit
* Tcllib
* TclX
* Tk
* XOTcl

References

* John K. Ousterhout, "Tcl and the Tk Toolkit", Addison-Wesley, Reading, MA, USA, ISBN 0-201-63337-X, 1994.
* Brent B. Welch, "Practical Programming in Tcl and Tk", Prentice Hall, Upper Saddle River, NJ, USA, ISBN 0-13-038560-3, 2003.
* J Adrian Zimmer, "Tcl/Tk for Programmers", IEEE Computer Society, distributed by John Wiley and Sons, ISBN 0-8186-8515-8, 1998.
* Mark Harrison and Michael McLennan, "Effective Tcl/Tk Programming", Addison-Wesley, Reading, MA, USA, ISBN 0-201-63474-0, 1998
* Mark Harrison (ed), "Tcl/Tk Tools", O'Reilly Media, ISBN 1-56592-218-2, 1997

Notes

External links

Main Tcl developer sites

* [http://www.tcl.tk/ Tcl Developer Xchange] Main Tcl developer site
** [http://www.tcl.tk/scripting/ Getting started with Tcl]
** [http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html Tcl Tutorial]
** [http://www.tcl.tk/doc/ Tcl Documentation] , and [http://www.tcl.tk/man/ Tcl Manual Pages]
** [http://www.tcl.tk/about/history.html History of Tcl] by the creator of the language.
* [http://wiki.tcl.tk/ Tcl'ers Wiki]
** [http://wiki.tcl.tk/11921 Description of Tcl's variable scoping rules]

Tcl distributions

* [http://www.activestate.com/Products/ActiveTcl/ ActiveState's Tcl distribution] for MS Windows, Mac OS X, Linux, Solaris, AIX, and HP-UX, with numerous libraries.
* [http://wintcltk.berlios.de/ WinTclTk] open-source MinGW-based distribution for Microsoft Windows with extensions

Tcl tutorials, books, etc.

* [http://www.purl.org/NET/Tcl-FAQ/ Tcl FAQ]
* [http://www.bin-co.com/tcl/tutorial/ A Tcl (Tutorial for Cool Languages) for Tcl/Tk]
* [ftp://ftp.procplace.com/pub/tcl/ Older Tcl Contributed Sources Archive]
* [http://dmoz.org/Computers/Programming/Languages/Tcl-Tk/ Open Directory: Tcl/Tk]
* [http://www.codecodex.com/wiki/index.php?title=Category:Tcl Tcl programming source code wiki] at [http://www.codecodex.com/ CodeCodex]
* [http://www.tcllinks.org/ TclLink Tcl/Tk Directory]
* [http://citeseer.org/cs?q=Tcl+Tk CiteSeer] Citations
* [http://jan.newmarch.name/ProgrammingUnix/tcl/tcl_tut.html A Short TCL Tutorial]
* [http://www.invece.org/tclwise/ Tclwise, a book on Tcl programming with online chapters] by [http://www.invece.org Salvatore Sanfilippo] .
* [http://jim.berlios.de The Jim Interpreter, is a small footprint implementation of the Tcl programming language] .
* [http://www.freesoftwaremagazine.com/free_issues/issue_04/software_testing_with_tcl/ An article on Software testing with Tcl for Apache Rivet]
* [http://philip.greenspun.com/tcl/ Tcl for Web Nerds] - A Tcl tutorial with emphasis on its use in web development.
* [http://www.neatware.com/studio/ MyrmecoX Studio] - An IDE for Tcl and Dynamic Languages Applications.
* [http://www.equi4.com/ Equi4 Software] - Tclkits, Starkits, Starpacks, Metakit and more
* [http://www.tclbridge.com/ TclBridge] - ActiveX/COM integration for Tcl/Tk.
* [http://www.tclscripting.com http://www.tclscripting.com] News and articles on software development with Tcl/Tk
* [http://antirez.com/articoli/tclmisunderstood.html Tcl the misunderstood] An essay describing the language's features
* [http://simpledevlib.sourceforge.net/ The Simple Development Library] A collection of commands and utilities aimed towards assisting software development in Tcl.
* [http://www.puppylinux.com/ Puppy Linux (extensively uses Tcl/TK for systems administration and configuration)] (Prior to Puppy version 4)


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • TCL — Семантика: императивный, скриптовый Тип исполнения: интерпретатор Появился в: 1988 г. Автор(ы): Джон Остераут Последняя версия: 8.5.7 / 15 апреля 2009 …   Википедия

  • Tcl — Skriptsprache mit Bytecode Interpreter Basisdaten Paradigmen: imperativ, funktional, generativ …   Deutsch Wikipedia

  • Tcl — Tool Command Language Desarrollador(es) Tcl Core Team[1] …   Wikipedia Español

  • TCL — Skriptsprache mit Bytecode Interpreter Basisdaten Paradigmen: imperativ, funktional …   Deutsch Wikipedia

  • Tcl/Tk — Tcl Skriptsprache mit Bytecode Interpreter Basisdaten Paradigmen: imperativ, funktional …   Deutsch Wikipedia

  • TCL — may mean:*Computer languages ** Tcl (Tool Command Language), a computer programming language ** Terminal Control Language , used to program VeriFone devices ** Terminal Control Language , a Pick operating system command language ** Trader… …   Wikipedia

  • Tcl — Cette page d’homonymie répertorie les différents sujets et articles partageant un même nom. {{{image}}}   Sigles d une seule lettre   Sigles de deux lettres > Sigles de trois lettres …   Wikipédia en Français

  • TCL — (pronunciado /tí.quel/, originado del acrónimo en inglés Tool Command Language o lenguaje de herramientas de comando, actualmente se escribe como Tcl en lugar de TCL ), es un lenguaje de script creado por John Ousterhout, que ha sido concebido… …   Enciclopedia Universal

  • TCL — (Tool Command Language) interpreted programming language used to develop prototype applications and CGI scripts (Computers) …   English contemporary dictionary

  • TCL/TK — Tool Command Language Pour les articles homonymes, voir Tcl. Apparu en 1988 …   Wikipédia en Français

  • Tcl/Tk — Tool Command Language Pour les articles homonymes, voir Tcl. Apparu en 1988 …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”