Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4737be2922b6ff87018183ec2e4fda2fbc031fa8
Ticket: 3304643fffffffffffffffffffffffffffffffff
User object info lost on more aggressive numeric conversion
User & Date: cjmcdonald on 2011-05-19 22:40:26
Changes

  1. icomment:
    Or always use the "eq" operator to do string comparisons on your objects, instead
    of "==".
    
    For better or worse I use a similar scheme, storing a pointer to a C++ object in
    the Tcl object internalRep.  The only difference is that my object string reps
    never look like a numeric value, but I don't think that will be an issue anyway if
    you use "eq".  I haven't had many problems with Tcl 8.5, and the scheme has
    proved reliable.  The only issues have been:
    
    Losing internal rep converting between a list and a dict, which also affected
    array get/set.  This have been fixed in later 8.5.x releases.
    
    Overly aggressive conversions using %s in [format], which unfortunately
    also affects parray, so that listing the contents of an array loses any
    internal reps.  I think that this has been fixed in the Tcl 8.6 head.
    
    Otherwise all OK, although it will never be an officially approved or supported
    method, as using the internalRep in that way breaks the Tcl "Everything
    is a string" contract.  These object representations consist of a string AND
    some hidden state (the C++ object), which cannot be inferred just from the string.
    
    
  2. login: "cjmcdonald"
  3. mimetype: "text/plain"
  4. username: "cjmcdonald"