Skip to content
Tcl Source Code History Of Ticket 3169002fffffffff
Login

History Of Ticket 3169002fffffffff

Artifacts Associated With Ticket 3169002fffffffff

  1. Ticket change [bf41ebf1a2] (rid 102220) by sehmann on 2011-01-31 22:10:25:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      When we use "array get" a dict object is returned.  If this is used directly in a foreach all types are preserved.  The problem arises when the result is copied.  It seems like the fix is to simply copy the objects as they are when converting from dict to list (tcl8.4.9 just appends the array object into the result list) rather than stringify the objects.
      
      we are trying to upgrade our system from 8.4.9 to 8.5.9 and this is a blocker.
      
      % array set a ""
      % set a(b) "1"
      1
      % set a(c) [list 1 2]
      1 2
      % otype [array get a]
      dict
      % set l [array get a]
      b 1 c {1 2}
      % otype $l
      dict
      % otype $l
      dict
      % foreach key [array get a] { puts "[otype $key]" }
      string
      int
      string
      list
      % otype $l
      dict
      % foreach key $l { puts "[otype $key]" }
      string
      string
      string
      string
      % otype $l
      list
      % puts $l
      b 1 c {1 2}
      %
      
      
    4. foundin initialized to: "obsolete: 8.5.9"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "sehmann"
    10. subsystem initialized to: "10. Objects"
    11. title initialized to:
      conversion from "dict" to "list" loses object types
      
    12. type initialized to: "Bug"
  2. Ticket change [21d5aa2ec8] (rid 130651) by andreas_kupries on 2011-02-01 05:16:32:

    1. icomment:
      I am not sure that it is the 'set l ...' which looses the type information of the elements. You are working interactively, and it may be the code printing the value to the terminal which does it.
      
      What is the output for
      
      % set l [array get a] ; foreach key $l { puts "[otype $key]" }
      
      This avoids the printing of 'l'.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  3. Ticket change [b297d2badf] (rid 98361) by sehmann on 2011-02-01 05:30:37:

    1. icomment:
      It prints the right thing... Hmm...
      % array set a ""
      % set a(b) "1"
      1
      % set a(c) [list 1 2]
      1 2
      % set l [array get a] ; foreach key $l { puts "[otype $key]" }
      string
      int
      string
      list
      
      But separating them does not:
      % array set a ""
      % set a(b) "1"
      1
      % set a(c) [list 1 2]
      1 2
      % set l [array get a]
      b 1 c {1 2}
      % foreach key $l { puts "[otype $key]" }
      string
      string
      string
      string
      
      Why would list operations behave ok in this regard?
      % set l [list 1 [list 1 2]]
      1 {1 2}
      % otype $l
      list
      % otype [lindex $l 0]
      int
      % otype [lindex $l 1]
      list
      %
      
      
      I forgot to add that otype is a C function we wrote to print the type of the object and is implemented like this:
          if ( obj->typePtr ) {
              char* typeName = obj->typePtr->name;
              Tcl_SetResult(interp, typeName, TCL_VOLATILE);
      
          } else if ( obj->bytes ) {
              Tcl_SetResult(interp, (char*)"string", TCL_STATIC);
      
          } else {
              Tcl_SetResult(interp, (char*)"unknown", TCL_STATIC);
          }
      
      
    2. login: "sehmann"
    3. mimetype: "text/plain"
    4. username: "sehmann"
  4. Ticket change [0202c6ba4c] (rid 119574) by msofer on 2011-02-01 19:14:29:

    1. assignee changed to: "dkf"
  5. Ticket change [ec7b57e00b] (rid 103715) by sehmann on 2011-02-03 02:51:00:

    1. icomment:
      puts $l
      also makes the issue appear.
      
      
    2. login: "sehmann"
    3. mimetype: "text/plain"
    4. username: "sehmann"
  6. Ticket change [d24f858e4a] (rid 113514) by dkf on 2011-02-03 04:15:00:

    1. closedate changed to: "2011-02-02T21:15:00"
    2. closer changed to: "dkf"
    3. icomment:
      Seems to be working exactly as designed. We do not guarantee (and never have guaranteed) that the "type" of values will be preserved; it does not represent type information in the same way that a Python or Ruby object's type does.
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"
    8. username: "dkf"
  7. Ticket change [a6cf3032c4] (rid 98667) by sehmann on 2011-02-04 03:11:08:

    1. icomment:
      Thanks, we need to rethink parts of our system that were relying on this...  You can close this issue.
      
      
    2. login: "sehmann"
    3. mimetype: "text/plain"
    4. resolution changed to: "None"
    5. status changed to: "Open"
    6. username: "sehmann"
  8. Ticket change [a19386de6f] (rid 109746) by dkf on 2011-10-01 14:50:47:

    1. closedate changed to: "2011-10-01T07:50:47"
    2. closer changed to: "dkf"
    3. icomment:
      
      
      allow_comments - 1
      
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Works For Me"
    7. status changed to: "Closed"
    8. username: "dkf"