Skip to content
Tcl Source Code History Of Ticket 1b0266d8bbc649bc
Login

History Of Ticket 1b0266d8bbc649bc

Artifacts Associated With Ticket 1b0266d8bbc649bc

  1. Ticket change [0c0ca53d92] (rid 138234) by andy on 2014-05-21 22:58:03:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      When given only one argument, [dict remove] and [dict replace] seem to return that argument without even looking at it.  Consequently, they can be made to return non-dicts (i.e. invalid list or odd list length) and noncanonical dicts (i.e. with duplicate keys).
      
      When given only one argument, [dict merge] forces the argument to be a dict (thereby rejecting non-lists and odd-length lists), but the string representation is preserved.  Consequently, [dict merge] can be made to return noncanonical dicts.
      
      % dict remove \{\}x
      {}x
      % dict remove {a 1 b}
      a 1 b
      % dict remove {a 1 b 2 a 3}
      a 1 b 2 a 3
      % dict replace \{\}x
      {}x
      % dict replace {a 1 b}
      a 1 b
      % dict replace {a 1 b 2 a 3}
      a 1 b 2 a 3
      % dict merge \{\}x
      list element in braces followed by "x" instead of space
      % dict merge {a 1 b}
      missing value to go with key
      % dict merge {a 1 b 2 a 3}
      a 1 b 2 a 3
      % ::tcl::unsupported::representation [dict merge {a 1 b 2}]
      value is a dict with a refcount of 3, object pointer at 0xbeb3b0, internal representation 0xbe11a0:0xbeb860, string representation "a 1 b 2"
      % ::tcl::unsupported::representation [dict merge {a 1 b 2 a 3}]
      value is a dict with a refcount of 5, object pointer at 0x1c3a560, internal representation 0x1c843a0:0x1c35790, string representation "a 1 b 2 a 3"
      
      Contrast with every other [dict] command that returns a dict and/or sets a dict variable.  They all produce only canonical dicts.
      
      % dict get {a 1 b 2 a 3}
      a 3 b 2
      % ::tcl::unsupported::representation [dict get {a 1 b 2 a 3}]
      value is a list with a refcount of 1, object pointer at 0x99cc90, internal representation 0x9adb00:(nil), no string representation
      % ::tcl::unsupported::representation [dict get {a 1 b 2}]
      value is a list with a refcount of 1, object pointer at 0x9a09e0, internal representation 0x9db0e0:(nil), no string representation
      
    5. foundin initialized to: "cdc4e05235717e4959d745e4cc6670bd1333c783"
    6. is_private initialized to: "0"
    7. login: "andy"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "662c23482b0bf6a505f39e48fb7ad43af8dee4d3"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "andy"
    14. subsystem initialized to: "15. Dict Object"
    15. title initialized to: "Single-argument [dict merge/remove/replace]"
    16. type initialized to: "Bug"
  2. Ticket change [1306529e02] (rid 138236) by aku on 2014-05-21 23:16:51:

    1. assignee changed to: "dkf"
    2. login: "aku"
    3. mimetype: "text/plain"
  3. Ticket change [0532e16db5] (rid 138332) by dkf on 2014-06-03 06:59:39:

    1. icomment:
      I think the non-canonicality is OK; the code isn't guaranteed to canonicalize when it doesn't have anything to do. However, the failure to confirm the format is indeed an (arguable) bug.<p>It'd be a Potential Incompatibility though.
      
    2. login: "dkf"
    3. mimetype: "text/html"
    4. username: "dkf"
  4. Ticket change [4cf7a8fb1d] (rid 138333) by dkf on 2014-06-03 07:09:53:

    1. icomment:
      To be exact, canonicality comes from the <i>modification</i> causing a purge of the old string representation. Consider this:
      <pre>
      % dict merge {
        a b
        c d
      } {} {} {}
      
        a b
        c d
      
      % dict merge {
        a b
        c d
      } {a b}
      a b c d
      </pre>
      (No, we aren't going to detect where a modification “does nothing”.)
      
    2. login: "dkf"
    3. mimetype: "text/html"
    4. username: "dkf"
  5. Ticket change [0fa6340089] (rid 138339) by dkf on 2014-06-03 07:31:08:

    1. icomment:
      Uncovered an issue when working on this; the error message is wrong.
      <pre>
      test dict-4.14 {dict replace command: type check is mandatory} -body {
          dict replace { a b {}c d }
      } -returnCodes error -result {<b><u>list</u></b> element in braces followed by "c" instead of space}
      </pre>
      It's a bit tricky to fix; the message comes out of <tt>TclFindElement</tt> and that both has a semi-exposed API and no way to actually affect it at the moment.
      
    2. login: "dkf"
    3. mimetype: "text/html"
    4. username: "dkf"
  6. Ticket change [8686330bc1] (rid 138409) by dkf on 2014-06-15 07:59:29:

    1. icomment:
      On the other hand, having <tt>dict replace</tt> and <tt>dict remove</tt> guarantee canonicality in their result (as long as it doesn't leak back into the argument) is reasonable; they parallel with <tt>lrange</tt>'s features in this area.
      <p>
      I think <tt>dict merge</tt> doesn't need the change, as that feels more like it's working with whatever people provide; it merges <i>your</i> dictionaries.
      
    2. login: "dkf"
    3. mimetype: "text/html"
    4. username: "dkf"
  7. Ticket change [95daacef5f] (rid 138410) by dkf on 2014-06-15 15:36:27:

    1. icomment:
      In fact, I completely refuse to promise canonicalization with <tt>dict merge</tt>, as that causes problems in compilation.
      
    2. login: "dkf"
    3. mimetype: "text/html"
    4. username: "dkf"
  8. Ticket change [bbe8a3c826] (rid 138415) by dkf on 2014-06-15 16:15:11:

    1. closedate changed to: "2456824.17721439"
    2. closer changed to: "dkf"
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. resolution changed to: "Fixed"
    6. status changed to: "Closed"