Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9df653f6cbab2c26cadf2481b467a0167b98d006a75e326eae9ad9e978999434
Ticket: a34733451b2cf189528061944466cf7ce7015008
Regression with TIP #636 in foreach
User & Date: apnadkarni on 2023-07-12 13:02:36
Changes

  1. icomment:
    My analysis might be misplaced so would be useful to have @pooryorick comment but ...
    
    Jan, I noticed you added int, double, index as additional "protected" types to TclDuplicatePureObj. Since lists (abstract and traditional) can also have the same issue - multiple string representations for the same internal rep - should those also be protected. In which case one wonders what's left and whether the whole exercise is worthwhile.
    
    Originally, the list code used TclListObjCopy as a specialized internal function. It was important from a performance perspective within its limited context.  TclDuplicatePureObj generalizes it to do more but given it does not preserve value semantics its applicability is limited to those same use cases. That hints to me that the protections be removed, and the semantics of the function changed to reflect values are not preserved, only intreps are, and all call sites changed to revert to Tcl_DuplicateObj when they fall outside those limited use cases.
    
    Alternately, each type could revert back to its own specialized "internal copy" as the list implementation used to. This also avoid all the checks present in the "generalized" TclDuplicatePureObj.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"