Tcl
Paradigm | multi-paradigm:object-oriented,functional,procedural,event-driven programming,imperative |
---|---|
Designed by | John Ousterhout |
Developer | Tcl Core Team |
First appeared | 1988 |
Stable release | 8.6.8 (Dec, 22 2017)/ December 22, 2017 |
Typing discipline | dynamic typing,everything can be treated as astring |
License | BSD-style[1] |
Filename extensions | .tcl,.tbc[2] |
Website | www |
Majorimplementations | |
ActiveTclAndrowish | |
Dialects | |
Jim | |
Influenced by | |
AWK,Lisp | |
Influenced | |
PHP,[3]Tea,PowerShell[4] |
Tcl(pronounced"tickle" ortee cee ell/ˈtiːsiːɛl/) orTool Command Languageis aHigh-level programming languagewhich can be used for many things. Tcl was made to be easy to use, but able to do many things.[5]Tcl's language is based on commands which tell thecomputerwhat to do or how to save avariable.Tcl is able to doobject-oriented,imperative,functional,orproceduralstyles.
Tcl is used a lot to inCto createprototypesquickly.[6]There areinterpretersavailable for manyoperating systems.This means many different kinds of computers are able to run Tclcode.Tcl is a very small language which means it is good to use asembedded systems.
Tcl is sometimes combined withTk.When it is, it is calledTcl/Tk.Tcl/Tk is a part of the normalPythoninstallation.
History
[change|change source]Tcl was created byJohn OusterhoutatUniversity of California, Berkeley.[7][8]Ousterhout won aACM Software System Awardin 1997 for making Tcl/Tk.[9]
Safe-Tcl is a form of Tcl that has certain parts turned off so it can't hurt the computer which is running it.Nathaniel BorensteinandMarshall Rosecreated Safe-Tcl. Safe-Tcl can only work on somefilesincluding email messages.
Examples
[change|change source]In Tcl programming, empty whitespace separates words. Commands are ended by going to a new line or asemicolon:
word0 word1 word2... wordN
The first word is always a command which comes from Tcl's library:
commandName arg1 arg2... argN
For example, the commmandputsmakes the computer display something:
puts"Hello, World!"
In that example, "Hello, World!" is called astring.Tcl adds a special character which can't be seen at the end of a line. This character tells the computer to go a new line after the command is complete.
Tcl is able to do math and many other things using variables. In order to use a variable, the programmer must set their value:
setvariableA1
setvariableB2
After a variable is set, it can be used in other parts of the program or set to something different. Variables can be used to perform math:
setx2
sety4
setans[expr$x+$y]
puts"The answer is $ans."#Thecomputerwouldshow:"The answer is 6."
The commandexprtells the computer to solve the "expression" or, in this case, anequation.
Easy commands
[change|change source]set
saves numbers, words, or letters, to a variable. It can also be used to change what is in a variable.proc
tells the computer what a new command will do (procedure).if
tells the computer to do what is written only if something is true.while
tells the computer to do what is written as long as something is true.foreach
tells the computer to something for each item in a list of variables.break
stops the command from running. This is good to use to get out of a loop.continue
stops the active command, but allows the loop to continue. If the loop is awhile
loop, it will start over. It will letforeach
andfor
go to the next step in the program.return
stops the active command and loop, then goes back to the procedure with a value.
Related pages
[change|change source]References
[change|change source]- ↑"Tcl/Tk License Terms".Tcl Developer Xchange.Retrieved2016-11-02.
- ↑"Tcl Dev Kit - Compiler".ActiveState Docs.Archived fromthe originalon 2016-10-20.Retrieved2016-11-02.
- ↑Lerdorf, Rasmus (2007-04-26)."PHP on Hormones – history of PHP presentation by Rasmus Lerdorf given at the MySQL Conference in Santa Clara, California".The Conversations Network. Archived fromthe originalon 2019-01-06.Retrieved2009-12-11.
- ↑"Windows PowerShell: PowerShell and WPF: WTF".Archived fromthe originalon 2008-12-25.Retrieved2018-09-25.
- ↑"Language".Tcl Developer Xchange.Retrieved2016-11-02.
- ↑"Uses for Tcl/Tk".Tcl Developer Xchange.Retrieved2016-11-02.
- ↑John Ousterhout."History of Tcl".Personal pages.Stanford University.Retrieved2011-08-09.
- ↑"History of Tcl".Tcl Developer Xchange.Retrieved2016-11-02.
- ↑"John K Ousterhout - Award Winner".ACM Awards.Retrieved2016-11-04.