Define a primitive data type: Difference between revisions

Content added Content deleted
(→‎{{header|Tcl}}: More on what a trace is)
Line 629: Line 629:


=={{header|Tcl}}==
=={{header|Tcl}}==
Tcl allows the programmer to create traces, procedures that execute when variables are read/written/unset
Tcl does not attach types to values or variables, but it does allow the programmer to create traces on variables that can be used to enforce type-like constraints among other things. Traces are procedures that execute when variables are read, written and/or unset. (Traces are also available for commands and for the execution of a script.) Tcl's compiler does not enforce these constraints; they're strictly runtime entities.
<lang tcl>namespace eval ::myIntType {
<lang tcl>namespace eval ::myIntType {
variable value_cache
variable value_cache