Am 22.06.25 um 08:50 schrieb Mark Summerfield:
I found that tcl::unsupported::representation says "pure string" for
strings and numbers and bools and lists; it only seems to distinguish
dicts (Tcl 9.0.1).
No, it doesn't. You seem to have the misconception that {1 2 3} is a
list of three values. It is actually a string, but can be treated as a list.
In Tcl, neither the values nor the variables do have a type in the sense
of Python. However, the runtime uses an internal cached typed
representation, which you can query.
See this transcript:
(chris) 49 % set a [list 1 2 3]
1 2 3
(chris) 50 % tcl::unsupported::representation $a
value is a list with a refcount of 4, object pointer at 0x5576f6d87430, internal representation 0x5576f6d57ab0:(nil), string representation "1 2 3" (chris) 51 % set b [dict a 1 b 2]
b 2
(chris) 52 % tcl::unsupported::representation $b
value is a dict with a refcount of 4, object pointer at 0x5576f6d86e30, internal representation 0x5576f6da2d60:(nil), string representation "b 2" (chris) 53 % set c [expr {1.0/3}]
0.3333333333333333
(chris) 54 % tcl::unsupported::representation $c
value is a double with a refcount of 4, object pointer at
0x5576f6d86cb0, internal representation 0x3fd5555555555555:(nil), string representation "0.33333333333..."
(chris) 55 % set d yes; if {$d} { puts yes }
yes
(chris) 56 % tcl::unsupported::representation $d
value is a booleanString with a refcount of 4, object pointer at 0x5576f6d880f0, internal representation 0x1:0x5576f6d815e0, string representation "yes"
(chris) 57 %
Read up on EIAS if you struggle to understand this. It is alos the
reason why this is in the "unsupported" namespace, because this command
breaks EIAS.
Christian
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)