Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 38a1220335d58fbf885e1f9e771ed9fba2aa9c894cffe5737b40772973f1c82d
Ticket: 47fd91176dd16609753b1a00ab3c46c3cc411765
Appending to a seven element dictonary causes issues
User & Date: oehhar on 2025-01-15 19:56:33
Changes

  1. icomment:
    Hi Mookie,
    
    thanks for the question.
    
    "dict append" appends all arguments to the text of the value of the given key.
    
    To use it the way intended:
    <verbatim>
    set d [dict create d1 v1]
    dict append d d1 v2 v3
    dict get $d d1 -> v1v2v3
    </verbatim>
    
    So, in your case:
    <verbatim>
    dict append MyDictonary store set block key field 3 "hello world"
    </verbatim>
    is equivalent to
    <verbatim>
    dict append MyDictonary store "setblockkeyfield3hello world"
    </verbatim>
    
    I think, in your example, you may just use "dict set".
    
    <verbatim>
    dict set MyDictonary store set block key field 3 "hello world"
    </verbatim>
    
    If you really want string append, there is no buildin support for nested dictionaries.
    
    So, if you want to append to a string in a nested dictionary, you can only:
    <verbatim>
    dict set MyDictionary store set block key field 3\
            [string cat [dict get $MyDictionary store set block key field 3]\
                "hello world"]
    </verbatim>
    
    Take care,
    Harald
    
  2. login: "oehhar"
  3. mimetype: "text/x-fossil-wiki"
  4. username: "oehhar"