Sujet : Re: a typeof command for debugging?
De : auriocus (at) *nospam* gmx.de (Christian Gollwitzer)
Groupes : comp.lang.tclDate : 23. Jun 2025, 07:06:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103aqto$12qup$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
Am 22.06.25 um 23:50 schrieb Schelte:
On 22/06/2025 21:22, Christian Gollwitzer wrote:
(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"
Funny. While clearing up one point, you are confusing readers again on another point: It may not immediately be clear how b can end up being the dictionary "b 2". The explanation is that the command [dict a 1 b 2] is interpreted as [dict append 1 b 2], because there is only one dict subcommand that starts with "a". Additionally "dict append" will create the dict if it doesn't yet exist. So this creates a dict in a variable called "1", with key "b" that has a value of "2". That dict is then also copied to the variable "b".
I suppose you actually intended to use [dict create a 1 b 2].
Good catch! I missed that one.
Christian