Skip to content
Tcl Source Code History Of Ticket 752814ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 752814ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 752814ffffffffffffffffffffffffffffffffff

  1. Ticket change [bb8bf74191] (rid 129504) by ysutjandra on 2003-06-11 18:54:42:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Hi,
      
      I found that regexp changes the object type to string 
      type.  I see this behavior in Tcl8.3.5 but not in Tcl8.1.
      
      The stack trace when it calls the registered function to 
      free the old internal representation looks as follows:
      
      #1  0x9d2a4 in SetStringFromAny (interp=0x0, 
      objPtr=0x11ebf8) at ./../generic/tclStringObj.c:1505
      #2  0x9bc3c in Tcl_GetCharLength (objPtr=0x11ebf8) 
      at ./../generic/tclStringObj.c:329
      #3  0x2fab4 in Tcl_RegexpObjCmd (dummy=0x0, 
      interp=0xfdd68, objc=2, objv=0xffdac) 
      at ./../generic/tclCmdMZ.c:227
      
      The question is why Tcl_GetCharLength requires 
      changing the internal representation to string object.  It 
      should simply call Tcl_GetStringFromObj and does a 
      strlen on the return C-string.
      
      Looking at the code tclCmdMZ.c, it has the following 
      comment...
      
        Get the length of the string that we are matching
        before getting the regexp to avoid shimmering problems.
      
      -- Yohan
      
    4. foundin initialized to: "final: 8.3.5"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "ysutjandra"
    9. subsystem initialized to: "43. Regexp"
    10. title initialized to: "Regexp change Tcl_Obj type to string"
    11. type initialized to: "RFE"
  2. Ticket change [be9315ce2e] (rid 102093) by hobbs on 2003-06-12 03:37:20:

    1. status changed to: "Pending"
  3. Ticket change [4a99492b03] (rid 126564) by hobbs on 2003-06-12 03:37:21:

    1. closedate changed to: "2003-06-11T20:37:21"
    2. closer changed to: "hobbs"
    3. icomment:
      Logged In: YES 
      user_id=72656
      
      Er ... so?  Why is this a bug report?  In any case, the RE 
      works with Unicode string objects, not utf-8 string objects.  
      The code comments are accurate.
      
      
    4. login: "hobbs"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. username: "hobbs"
  4. Ticket change [a19814b613] (rid 109751) by ysutjandra on 2003-06-12 03:48:59:

    1. icomment:
      Logged In: YES 
      user_id=799156
      
      At the very least, it should check whether the Tcl_Obj is 
      shared or not, and create a utf-8 string object on a new 
      Tcl_obj.  Don't you think?
      
      Just curious, what is shimmering problem?  Where can I get 
      reference to understand shimmering problem...?
      
      
    2. login: "ysutjandra"
    3. mimetype: "text/plain"
    4. status changed to: "Open"
    5. username: "ysutjandra"
  5. Ticket change [6fc52f5cfb] (rid 100369) by dkf on 2003-06-12 04:06:46:

    1. assignee changed to: "dkf"
    2. closedate changed to: "2003-06-11T21:06:46"
    3. closer changed to: "dkf"
    4. icomment:
      Logged In: YES 
      user_id=79902
      
      At the moment, I'm tempted to say that the modification in
      behaviour in a place which is not generally exposed visibly
      at the script level is a consequence of a bug getting fixed.
       Please describe why you believe this to be a problem.
      
      Object types are implementation features; mere caches of
      representations, and not something deeper.
      
      
    5. login: "dkf"
    6. mimetype: "text/plain"
    7. status changed to: "Pending"
    8. subsystem changed to: "18. Commands M-Z"
    9. username: "dkf"
  6. Ticket change [03f98bb41c] (rid 119915) by dgp on 2003-06-12 04:08:16:

    1. assignee changed to: "nobody"
    2. icomment:
      Logged In: YES 
      user_id=80530
      
      
      Tcl_GetCharLength() returns the number of
      characters in the string, not the number of
      bytes.
      
      strlen(Tcl_GetStringFromObj) returns the
      number of  bytes in the string, not the
      number of characters.
      
      They do not do the same thing, so you can't
      propose the latter as a replacement for
      the former.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. status changed to: "Open"
    6. subsystem changed to: "43. Regexp"
    7. username: "dgp"
  7. Ticket change [b3048b0445] (rid 98445) by ysutjandra on 2003-06-12 05:20:52:

    1. icomment:
      Logged In: YES 
      user_id=799156
      
      I'm sorry I said the wrong thing.
      
      I said..
         At the very least, it should check whether the Tcl_Obj is 
         shared or not, and create a utf-8 string object on a new 
         Tcl_obj.
      
      I meant to say,
      
         At the very least, it should check whether the Tcl_Obj is 
         shared or not, and create a unicode string object on a new 
         Tcl_obj.
      
      
      I guess it's fine if it's a requirement that regexp will change 
      any object type to a string.  I understand from your 
      explanation that the regexp has to operate on an object with 
      unicode type, leading to converting the old representation (of 
      the type I registered) to the unicode representation and leads 
      to freeing the old representation.  
      
      
      I am trying to make use of Tcl memory management on 
      Tcl_Obj by registering my own object type so that it will call 
      the registered free function once it knows the object is not 
      needed anymore.
      
      In other words, I registered a new object-type, and I want 
      the Tcl_Obj that holds my object to stay as is throughout its 
      lifespan.  ie. it will only call the free function when the 
      refCount is zero.
      
      Now I want to stop users from executing commands that will 
      convert the object of my type to something else.  Probably 
      something like:
      
         set a [newMyType]
         regexp {hello} $a
         --> Illegal operation on variable a, 
         --> converting 'MyType' to 'string' is prohibited
      
         incr a
         --> Illegal operation on variable a,
         --> converting 'MyType' to 'int' is prohibited
      
      Currently, I know only how to detect this by implementing a 
      free function that detects whether the refCount is already 
      zero or not.  But this function returns void and I cannot stop 
      the users from doing this.
      
      I'm okay if there is a way to prevent users from using such 
      commands on my obj.  Is there a way to return an error at a 
      situation like this now.
      
      
      
      
    2. login: "ysutjandra"
    3. mimetype: "text/plain"
    4. username: "ysutjandra"
  8. Ticket change [2cc2937711] (rid 118962) by dkf on 2003-06-12 15:28:32:

    1. foundin changed to: "None"
    2. icomment:
      Logged In: YES 
      user_id=79902
      
      That's not a supported mode of operation, though it's one
      that I know I would like to support.  However, the core is
      not currently up to it and is not likely to change in this
      respect in 8.* as it would require both non-trivial
      alterations to the Tcl_ObjType structure and a thorough
      code-review of a large fraction of the core to ensure that
      there aren't any holes where something could slip through. 
      The current policy is that internal representations are just
      caches of what can be derived (possibly in some context)
      from the utf-8 string version of the object.
      
      BTW, I've done "magic objects" in the past and it works
      fairly well so long as you don't look at them in any way
      that doesn't understand exactly what they are.  Putting them
      into variables and lists is fine.  Treating them as strings
      or ints and you are on dangerous ground.
      
      This is a FRQ, not a bug.
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. subsystem changed to: "None"
    6. username: "dkf"
  9. Ticket change [47ce7609de] (rid 99767) by dkf on 2003-06-12 15:29:52:

    1. assignee changed to: "dkf"
    2. resolution changed to: "Later"
    3. subsystem changed to: "10. Objects"
  10. Ticket change [5c2a02fc88] (rid 115249) by dkf on 2003-06-25 03:07:30:

    1. title changed to: "Inhibit some type conversions"
  11. Ticket change [4d2a74d66b] (rid 127017) by dkf on 2004-06-16 05:06:01:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      See also RFE 219162
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"