Skip to content
Tcl Source Code History Of Ticket 745851ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 745851ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 745851ffffffffffffffffffffffffffffffffff

  1. Ticket change [5b92aa5e88] (rid 118352) by jenglish on 2003-05-30 01:15:36:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      A useful addition to [dict] would be a command that
      sets multiple dictionary entries in a single step:
      
      dict merge $dictval1 $dictval2 ? ... $dictvalN ?
      
      which would return a copy of $dictval1, extended or
      modified by the values in $dictval2.  If multiple
      arguments are supplied, values in later arguments
      override those in earlier ones.
      
      That is:
      
      proc dict_merge {dict1 args} {
           foreach dict $args {
              foreach {key value} $dict {
                  dict set $dict1 $key $value
              }
           }
          return $dict1
      }
      
      (This was discussed on tcl-core, but the vote on TIP
      111 was already in progress so it didn't make it into
      the initial implementation.)
      
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "jenglish"
    9. subsystem initialized to: ""
    10. title initialized to: "[dict merge]"
    11. type initialized to: "Support"
  2. Ticket change [53a1dd506b] (rid 93792) by jenglish on 2003-05-30 08:17:05:

    1. icomment:
      Logged In: YES 
      user_id=68433
      
      
      [dict merge] can also be expressed as:
      
          [eval dict replace [list $dict1] $dict2 ... $dictN]
      
      but I'd prefer a solution that doesn't involve [eval].
      
      A variant form that operates on dictionary variables would
      also be useful (don't know what to call it though.)
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  3. Ticket change [378ff5298c] (rid 107303) by dkf on 2003-05-30 15:48:44:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      A better implementation might go like this:
      
      proc dict_merge {dict1 args} {
         foreach dict $args {
            dict for {key val} $dict {
               dict set dict1 $key $val
            }
         }
         return $dict1
      }
      
      However, would using C for this purpose be a significant
      advantage?  It increases the maintenance load, after all...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  4. Ticket change [f86c34bed6] (rid 91533) by jenglish on 2003-05-31 00:42:02:

    1. icomment:
      Logged In: YES 
      user_id=68433
      
      > would using C for this purpose be a significant
      advantage?  
      > It increases the maintenance load, after all...
      
      So that it could be spelled [dict merge] instead of
      [dict_merge] :-).  There are minor efficiency issues as
      well.
      
      But mostly, this is a useful primitive operation on
      dictionaries that (I feel) should be part of the core
      interface.
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  5. Ticket change [312534f929] (rid 93374) by jenglish on 2003-09-06 08:48:49:

    1. icomment:
      
      
      File Added - 60765: tcl-dict-merge.patch
      
      Logged In: YES 
      user_id=68433
      
      (Let's see if SourceForge is working today...)
      
      Attached patch implements [dict merge].  Documentation and
      test cases still missing.
      
      This might also be a useful thing to have in the C
      interface, should refactor.
      
      PS: for a real-live, actual use case, see  'proc myReturn'
      in the EXAMPLES section of return.n (r1.7), which currently
      uses:
      
          set options [eval [list dict create -level 1] $args]
      
      This could be replaced with
      
         set options [dict merge {-level 1} $args]
      
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  6. Add attachment "tcl-dict-merge.patch" [897f94f4a3] (rid 132035) by jenglish on 2003-09-06 08:48:49.

  7. Ticket change [85f2341501] (rid 131414) by dkf on 2003-09-07 03:16:36:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Good use case.  Just what I wanted. I'd be happy to support
      a TIP.
      
      (I'm less certain about the C interface.  Merging is a
      pretty trivial thing to do with the current C API after all.)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  8. Ticket change [a96fe60e80] (rid 99147) by jenglish on 2003-09-07 23:45:21:

    1. icomment:
      Logged In: YES 
      user_id=68433
      
      Argh, does this really require a TIP?  I was under the
      impression that since [dict] has not yet appeared in an
      official release that the details were still fluid.
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  9. Ticket change [af33d73bf0] (rid 97766) by jenglish on 2004-02-21 08:34:16:

    1. icomment:
      Logged In: YES 
      user_id=68433
      
      Just found myself wanting [dict merge] again; raising the
      priority.
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. priority changed to: "7 High"
    5. username: "jenglish"
  10. Ticket change [e56d46db0c] (rid 104116) by dkf on 2004-02-21 19:39:00:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Patch review: Shouldn't duplicate the first dictionary
      piecemeal.  Better to insert the values into that (if
      shared, use the standard Tcl_DuplicateObj idiom to unshare it).
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  11. Ticket change [d6ef336997] (rid 123895) by jenglish on 2004-02-29 03:54:29:

    1. icomment:
      Logged In: YES 
      user_id=68433
      
      Updated patch including suggestion below (though I'm not
      sure if this isn't a premature optimization; it won't affect
      the asymptotic runtime in normal circumstances).  Also
      includes documentation and a rudimentary update to the test
      suite.
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  12. Add attachment "tcl-dict-merge.patch" [c0b51b4714] (rid 102461) by jenglish on 2004-02-29 03:54:30.

  13. Ticket change [01b21a8000] (rid 119529) by jenglish on 2004-02-29 03:54:30:

    1. icomment:
      
      
      File Added - 78372: tcl-dict-merge.patch
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  14. Ticket change [5b6b10f504] (rid 118319) by dkf on 2004-03-02 04:24:40:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      It won't make *any* performance difference except in the
      case where someone hands in an unshared object, and then
      (especially if the object was large) the difference is going
      to be much more significant.  Many list commands (and other
      dict subcommands) behave this same way; it is a common core
      idiom and there are coding patterns that take advantage of
      it to good effect.
      
      Forcing a full copy is just unfriendly.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  15. Ticket change [414f7e5910] (rid 116167) by dkf on 2004-03-13 06:32:59:

    1. resolution changed to: ""
    2. status changed to: "Closed"
  16. Ticket change [ef6ecea70f] (rid 108993) by dkf on 2004-03-13 06:33:00:

    1. closedate changed to: "2004-03-12T23:33:00"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      TIP was accepted and implemented.
      
      Although it was an inspiration, I didn't use the submitted
      patch because:
       * The implementation had problems triggerable by attempting
      to merge non-dictionary values.
       * The documentation wording wasn't quite clear.
       * The test suite was too incomplete for my taste (I prefer
      to test as many failure modes as possible.)
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. username: "dkf"
  17. Ticket change [f46dc4dcc0] (rid 129913) by dkf on 2008-12-07 18:30:38:

    1. icomment:
      
      
      data_type - 210894
      
      
      
    2. is_private changed to: "1"
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. subsystem changed to: "None"
    6. username: "dkf"
  18. Ticket change [4be4d3048d] (rid 126781) by dkf on 2009-07-29 19:41:30:

    1. icomment:
      
      
      IP - Comment Removed: 130.88.1.31
      
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"