Skip to content
Tcl Source Code History Of Ticket 862526872cda0746
Login

History Of Ticket 862526872cda0746

Artifacts Associated With Ticket 862526872cda0746

  1. Ticket change [91d0711c7a] (rid 141586) by anonymous on 2015-04-20 17:44:24:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      When getting an element of a list using "lindex" or getting an element of a dict using "dict get", the procedure returns a string.
      
      In the situation that some user wants to traverse recursively this data structure, or wants simply a subnode of this data structure for processing he has to convert the string into a dict or a list again.
      
      I would be nice a subcommand similar to this:
          - dict subnode key? key? key? ...
          - list subnode key? key? key? ...
      
      This subcommand returns the subnode with the same type as the container for that key. I mean that "dict subnode" should returns another dict and "list subnode" another list.
      
      This new subcommand would be interesting for performance manipulating complex data structures.
      
      This script shows that "dict get" and "lindex" returns a string object instead of a dict or list object:
      
      set a [list 1 2 {1 1 2332 {12 12} } 23]
      puts "a inner representation: \n\t[::tcl::unsupported::representation $a]\n"
      
      set b [lindex $a 2]
      puts "b inner representation: \n\t[::tcl::unsupported::representation $b]\n"
      
      set c [dict create key1 val1 key2 {key21 val21 key22 {key221 val221} } key3 val3]
      puts "c inner representation: \n\t[::tcl::unsupported::representation $c]\n"
      
      set d [dict get $c key2 key22]
      puts "d inner representation: \n\t[::tcl::unsupported::representation $d]\n"
      
    5. foundin initialized to: "8.6"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "1c4b6cdb98c9dfc4d1e74018f3f4efa00ad217e2"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "- New Builtin Commands"
    15. title initialized to:
      Getting another object of the same type in dict and list for performance
      
    16. type initialized to: "Bug"
  2. Ticket change [376dc94f84] (rid 141591) by ferrieux on 2015-04-20 20:32:19:

    1. closedate changed to: "2457133.35578027"
    2. closer changed to: "ferrieux"
    3. icomment:
      There is no such thing as a "force to string" by either list or dict containers; they do respect whatever current representation their contents have.
      
      In the examples given, constant *strings* like {1 1 2332 {12 12} } are passed in and gotten out. Make them shimmer before encapsulation, they'll keep their state:
      
       set x {1 2 3 4}
       lindex $x 0
       set a [list $x $x $x]
       set b [lindex $a 2]
       puts "b inner representation: \n\t[::tcl::unsupported::representation $b]\n"
      
      => 
       b inner representation: 
              value is a list with a refcount of 8, object pointer at 0x8daa208, internal representation 0x8df8db8:(nil), string representation "1 2 3 4"
      
    4. login: "ferrieux"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"