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

History Of Ticket 223217ffffffffff

Artifacts Associated With Ticket 223217ffffffffff

  1. Ticket change [b60d652413] (rid 125359) by jgreene on 2000-11-23 01:42:20:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      When processing the Uplevel command, TCL needlessly recreates the relevant command (the one passed as an argument to uplevel) from the string representation.  Here are the details:
      
      Start interactive tcl and give the simple command "put 7". Here "put" is a unique prefix of "puts". This causes us to call the unknown command, which eventually calls "uplevel puts 7".
      
      In Tcl_UplevelObjCmd, line 581 of tclProc.c, we set:
      
        optLevel = TclGetString(objv[1])
      
      This call seems intended to see if first argument, objv[1], is an integer giving the level to use.  However, the syntax of uplevel allows us to omit this argument, in which case objv[1] is actually a list containing objects representing the command we wish to execute. As a side effect, this call sets the string representation of the list object, which will be significant later.
      
      On line 604 we call Tcl_EvalObjEx, passing the list object (which is now objv[0] as a result of the increment on line 590, where result was 0).
      
      In Tcl_EvalObjEx, we decide whether to execute the command and arguments as a vector of Tcl_Objs (line 2575 of tclBasic.c) or by converting the list object to a string and passing that (line 2580). For some reason (perhaps a good one, I don't know) if objPtr (which is in this case a list) already has a string representation we use that. This happens even though the object representation is perfectly valid.
      
      As a result, we needlessly reinterpret the string.
      
      Why is this a problem? 
      
      1. Inefficiency of having to reinterpret the string.
      
      2. There may be cases where it is impossible to reconstruct an internal representation from a string.  This is my real concern.
      
      Consider the common case of an extension module which registers its own Tcl_TypeObj. The internal representation is a pointer to a C++ class instance and I define a freeInternalRepProc callback to free my instance when the Tcl_Obj's reference count goes to 0.  I can certainly provide a function to get a string representation of the
      pointer value. I can also reconstruct the pointer value from the string rep, but how do I know that the instance hasn't been deleted already?
      
      Does TCL really require the ability to reconstruct an internal rep from a string (for better reasons than in the case reported above)? If so, where and why?
      
      
    4. foundin initialized to: "obsolete: 8.3.2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "jgreene"
    9. subsystem initialized to: "81. Bundled Packages"
    10. title initialized to:
      uplevel needlessly reconstructs internal rep from string
      
    11. type initialized to: "Bug"
  2. Ticket change [fedf90b6c3] (rid 108659) by dkf on 2000-11-23 21:22:13:

    1. assignee changed to: "dkf"
    2. closedate changed to: "2000-11-23T14:22:13"
    3. closer changed to: "dkf"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [e0f55e86c0] (rid 87362) by dgp on 2001-04-05 08:09:40:

    1. closedate changed to: "2001-04-05T01:09:40"
    2. closer changed to: "dgp"
    3. subsystem changed to: "22. [proc] and [uplevel]"