Category:Tcl: Difference between revisions

(Added pseudo-BNF for Tcl)
Line 46:
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
Anonymous user