Tcl Library Source Code

View Ticket
Login
Ticket UUID: 3042811
Title: huddle bug in dicts with complex keys
Type: Bug Version: None
Submitter: coldstore Created on: 2010-08-11 00:00:27
Subsystem: huddle Assigned To:
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-11-21 08:42:17
Resolution: Fixed Closed By: serhiy.storchaka
    Closed on: 2026-11-21 08:42:16
Description:
package require huddle

set bb [huddle create {a b} b c d]
puts [huddle jsondump $bb]

Run it, it produces:

key "{a b}" not known in dictionary
    while executing
"dict get $src $key"
    (procedure "::huddle::_dict_setting" line 22)
    invoked from within
"$types(callback:$tag) get_sub $src $path"
    (procedure "_get2" line 4)

I presume there's something in huddle which inappropriately deals with complex key cases.
User Comments: serhiy.storchaka added on 2026-11-21 08:42:17:

The old huddle 0.1.x passed the key path through args with an extra level of list quoting, so keys containing spaces failed. The huddle 0.2 rewrite in [02ec11eeba] (Tcllib 1.18) fixed this. Verified: the example fails with huddle 0.1.5 and gives {"a b": "b", "c": "d"} on current trunk with Tcl 8.6 and 9.1.


anonymous (claiming to be Ryan Fox) added on 2013-11-18 21:25:06:
I think this can be fixed by calling join on the key in all calls into dict within huddle. ie:

return [dict get $src [join $key]]
dict set src [join $key] $value