Skip to content
Tcl Source Code History Of Ticket 883865ffffffffff
Login

History Of Ticket 883865ffffffffff

Artifacts Associated With Ticket 883865ffffffffff

  1. Ticket change [f9e99c889e] (rid 91776) by cnassau on 2004-01-24 22:40:19:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Currently TIP 111 declares that
      
         dict get $dictVal $k1 $k2 ... $kn 
      
      throws an error if $dictVal does not contain a value
      for the given key sequence. I would suggest to add a
      switch ?-nocomplain? where "dict get" would simply
      return an empty string in this case. 
      
      There is a recent related discussion on the dict page
      of the Tcl'ers Wiki. There I tried to make the point
      that there are legitimate use cases where the
      distinction between a non-existing key and a key with
      an empty value is deliberately blurred.
      
      
    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: "cnassau"
    9. subsystem initialized to: "16. Commands A-H"
    10. title initialized to: "Add ?-nocomplain? switch to [dict get]"
    11. type initialized to: "RFE"
  2. Ticket change [0e0f411a91] (rid 94546) by dkf on 2004-01-27 16:35:32:

    1. closedate changed to: "2004-01-27T09:35:32"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      No.  I (and other Core Team members and Core Maintainers)
      hate "-nocomplain" options, and there's already a [dict
      exists] operation to let you create your idea of defaulting
      getter as a composite operation.  For example:
        proc dictgetwithdefault {dict default key args} {
           if {[dict exists $dict $key {expand}$args]} {
              return [dict get $dict $key {expand}$args]
           } else {
              return $default
           }
        }
      
      A separate get-with-default subcommand for [dict] would have
      more sympathy from me, but only if there is performance data
      to justify doing it.
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Rejected"
    7. status changed to: "Closed"
    8. subsystem changed to: "15. Dict Object"
    9. username: "dkf"