Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 77c3e77da0ea438e32df9eba8712e5fdf15ee97104fa8e8ee64b41379e1a931b
Ticket: 67d5f75c36cbada6cf2361aaf49cffa61281143b
[$interp eval $lambda] after [eval $lambda] or vice versa fails
User & Date: apnadkarni on 2024-10-01 17:50:19
Changes

  1. icomment:
    Possible fix at [de39c09363]. This attempts to mimic 8.6 by recompiling the lambdaon an interp mismatch. Fixes the reported bug and passes test suite.
    
    I am however uncomfortable for a couple reasons.
    
    1. I am not sure this exactly or completely imitates the 8.6 implementation or behavior given the extensive refactoring in that area.
    
    2. More important, even with 8.6 I am not sure how all this recompilation of a lambda would with work in the middle of an execution. For example, the following code which passes a lambda *in the middle of its execution* to a subinterpreter which also executes the lambda.
    
    ```
    set lambda3 [list apply {{id lambda args} {
        puts Hi:$id
        if {[llength $args]} {
            [lindex $args 0] eval $lambda child [list $lambda]
        }
        puts Bye:$id
    }}]
    
    ```
    
    The internal rep of a lambda stores a pointer to the interpreter it was compiled in (within a Proc struct). When the call to the child is made, the lambda is recompiled and the internal rep points to the child interpreter. When that call returns, does the lambda in the main continue with the internal rep pointing to the child interpreter ? Or is it restored to the main interpreter? If the latter, I can't figure out where. If the former, isn't that a problem (but I don't yet know how to construct a case to illustrate that it is).
    
    A second pair of eyes would be helpful.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"