Variable size/Set: Difference between revisions

Content added Content deleted
m (omit Ruby)
(Things like hash tables are now stored in a more optimised manner.)
Line 45: Line 45:


=={{header|Tcl}}==
=={{header|Tcl}}==
In Tcl, all values are (Unicode) strings. Their size is measured in characters, and the minimum size of a string is of course 0.
In Tcl, most values are (Unicode) strings. Their size is measured in characters, and the minimum size of a string is of course 0.
However, one can arrange, via write traces, that the value of a variable is reformatted to bigger size. Examples, from an interactive [[tclsh]] session:
However, one can arrange, via write traces, that the value of a variable is reformatted to bigger size. Examples, from an interactive [[tclsh]] session:
<lang Tcl>% proc format_trace {fmt _var el op} {upvar 1 $_var v; set v [format $fmt $v]}
<lang Tcl>% proc format_trace {fmt _var el op} {upvar 1 $_var v; set v [format $fmt $v]}