Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e0ef59f898afacfc0e9ecb5d230a55178edd75e4
Ticket: 926590ffffffffffffffffffffffffffffffffff
Re-entering an interp keeps procedure context
User & Date: jaspert on 2004-03-31 10:38:20
Changes

  1. assignee changed to: "hobbs"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Not sure if this is a bug, but it seems very strange to
    me and there is no mention in the documentation.
    
    Normally if you execute a command in an interp using
    [interp eval] then that command is executed in global
    context. However if it is executed as part of a
    procedure in the parent interp that has been called by
    alias from another procedure in the same slave interp,
    then the command is executed in that slave interp
    procedure's context. I would expect it to go back to
    global context.
    
    Here's an example:
    
    /usr/local/ActiveTcl/bin/wish
    % info patchlevel
    8.4.6
    % set foo [interp create]
    interp0
    % $foo eval set nodecount 100
    100
    % $foo eval set nodecount
    100
    % $foo alias bar bar
    bar
    % proc bar {} {global foo; $foo eval set nodecount}
    % bar
    100
    % $foo eval bar
    100
    % $foo eval [list proc oink {} {bar}]
    % $foo eval oink
    can't read "nodecount": no such variable
    
    # next bit shows that if slave is entered from a
    different slave rather than itself, context is global
    
    % set foo2 [interp create]
    interp1
    % $foo2 alias bar bar
    bar
    % $foo2 eval [list proc oink {} {bar}]
    % $foo2 eval oink
    100
    
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "jaspert"
  9. subsystem changed to: "20. [interp]"
  10. title changed to: "Re-entering an interp keeps procedure context"
  11. type changed to: "Bug"