Category:Tcl: Difference between revisions
Content added Content deleted
(Tcl is a dynamic programming language) |
(Added more detailed description of Tcl's value model and fundamental types.) |
||
Line 23: | Line 23: | ||
Its creator, John Ousterhout, wrote about it: |
Its creator, John Ousterhout, wrote about it: |
||
:''“I got the idea for Tcl while on sabbatical leave at DEC's Western Research Laboratory in the fall of 1987. I started actually implementing it when I got back to Berkeley in the spring of 1988; by summer of that year it was in use in some internal applications of ours, but there was no Tk. The first external releases of Tcl were in 1989, I believe. I started implementing Tk in 1989, and the first release of Tk was in 1991.”'' |
:''“I got the idea for Tcl while on sabbatical leave at DEC's Western Research Laboratory in the fall of 1987. I started actually implementing it when I got back to Berkeley in the spring of 1988; by summer of that year it was in use in some internal applications of ours, but there was no Tk. The first external releases of Tcl were in 1989, I believe. I started implementing Tk in 1989, and the first release of Tk was in 1991.”'' |
||
==Language Value Model== |
|||
Tcl's value model operates on two levels. |
|||
* Classically, it is defined purely on unmodifiable strings over a language of unencoded UNICODE characters. |
|||
* Practically, values are polymorphic and hold a cache of the last type-interpretation that they were used with, together with an optional UTF-8 string representation. They are reference counted and are not modifiable (unless the code in question holds the only reference, which is a significant efficiency gain; if the value is shared, it is shallow-copied upon modification). Although only reference counted, they are effectively garbage-collected since circular data structures cannot be constructed (performing such construction requires holding two references to the same object, which forces a copy to be taken and breaks the reference loop). The net effect of this is just like the UNICODE string classical model, except much faster. |
|||
The language supports the following basic types, together with many defined by extension packages: |
|||
* Unicode strings |
|||
* Binary strings |
|||
* Integers of unbounded width |
|||
* Double-precision IEEE floats |
|||
* Booleans |
|||
* Lists of values |
|||
* Dictionaries mapping values to values |
|||
* Assorted "cache" types used to boost performance: |
|||
** Command handles (several types) |
|||
** Variable handles (several types) |
|||
** Compiled regular expressions |
|||
** Compiled scripts (several types) |
|||
** etc. |
|||
Note that all variables can hold values of ''any'' type; the language does not impose type constraints on variables at all. |
|||
==External Links== |
==External Links== |