Skip to content
Tcl Source Code History Of Ticket 1037235fffffffffffffffffffffffffffffffff
Login

History Of Ticket 1037235fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 1037235fffffffffffffffffffffffffffffffff

  1. Ticket change [0b24650be4] (rid 113933) by muehlebachs on 2004-09-29 19:36:48:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The goal is to create a nested dictionary (foo) with
      the following mappings:
      
          a -> A
          bc -> b -> B
          bc -> c -> C
      
      One would expect to do it by:
      
          dict set foo a A
          dict set foo bc b B
          dict set foo bc c C
      
      But this leads to the error (key "bc" not known in
      dictionary). Instead it has to be done by:
      
          dict set foo a A
          dict set foo bc [dict create b B c C]
      
      After the mappings are created, the values can be
      changed by:
      
          dict set foo a AA
          dict set foo bc b BB
          dict set foo bc c CC
      
      The different treatment of mappings at the 'top level'
      and at a 'lower level' should either be
      removed/corrected or mentioned in the docu.
      
      
    4. foundin initialized to: "obsolete: 8.5a1"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "muehlebachs"
    9. subsystem initialized to: "15. Dict Object"
    10. title initialized to: "Inconsistency in 'dict set'"
    11. type initialized to: "Bug"
  2. Ticket change [0ecd859209] (rid 94677) by dkf on 2004-09-30 17:31:49:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Workaround:
      Put
         dict set foo bc {}
      before you set the components of bc
      Problem: only safe when know element does not exist or is empty
      
      Workaround #2:
      Put
         dict append foo bc
      sometime before you set the components of bc; this will
      create the dictionary entry if it does not already exist,
      and will otherwise have no effect. (i.e. it is safe and
      won't lose data. As it happens, it also won't do loads of
      shimmering either, which is even better!)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  3. Ticket change [a6a626d50f] (rid 98642) by dkf on 2004-09-30 17:53:30:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Question:
        What do you think the following should do:
           set foo {}
           dict set foo a A
           dict unset foo bc b
           dict set foo bc c C
      (I ask because it affects exactly what kind of fix is to be
      designed.)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  4. Ticket change [54a8af0f5f] (rid 93987) by dkf on 2004-09-30 19:18:11:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      BTW, the difference is currently between the leaf dictionary
      and the branch dictionaries.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  5. Ticket change [284c13b59a] (rid 88679) by muehlebachs on 2004-10-02 02:27:52:

    1. icomment:
      Logged In: YES 
      user_id=1130415
      
      Thanks for your respons(es). The first workaround looks
      quite reasonable to me.
      
      Answers to your question:
      
          set foo {}
          dict set foo a A
      >>> creates a new mapping in 'foo': a->A
          dict unset foo bc b
      >>> error! since there is no key 'ab' in 'foo'
          dict set foo bc c C
      >>> creates a new mapping in 'foo': bc->c->C
      
      So the resulting dictionary should look like:
      
          a A bc {c C}
      
      
      
    2. login: "muehlebachs"
    3. mimetype: "text/plain"
    4. username: "muehlebachs"
  6. Ticket change [0e4acdb3c2] (rid 94590) by dkf on 2004-10-04 14:53:37:

    1. closedate changed to: "2004-10-04T07:53:37"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      Thanks for your feedback; that's now the way that
      dictionaries behave in the HEAD. :^)
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dkf"