Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9bcd341542425464adc09ba12789e4f7e101ab85ddb48fc9af1965ea1248b40a
Ticket: 66c2e8c97414a1f908d48753490526bb1cded0f4
Interpreter name resolution has problems with namespaces
User & Date: kjnash on 2020-07-21 12:15:47
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    The interp command recognizes "foo" and "::foo" as different interpreter names.  However, the two interpreters have the same interpreter command.  When "::foo" is created below, the command for interpreter "foo" is overwritten and so interpreter "foo" is deleted.
    
    The problem is that, because "interp" creates a command for each interpreter, its rules for name resolution should not differ from the rules for name resolution of commands.
    
    Suggested remedy: "interp" should recognize interpreter names as equal only if their fully-qualified namespace names are equal.
    
    When there are multiple levels of interpreters, e.g. a slave ::foo with its own slave {::foo ::bar}, the name in the master interpreter is a list, and each element in the list should be compared with its peers by their fully-qualified namespace names.  This ensures the same outcome if interpreter {::foo ::bar} is created in the master, as if interpreter ::bar is created in the slave ::foo.
    
    The usual, expected behavior:
    
    % interp create foo
    foo
    % interp create foo
    interpreter named "foo" already exists, cannot create
    
    The unexpected behavior:
    
    % interp create foo
    foo
    % interp create ::foo
    ::foo
    % interp slaves
    ::foo
    
    Check that the interpreter really has been replaced:
    
    % interp create foo
    foo
    % foo eval set a abc
    abc
    % foo eval set a
    abc
    % interp create ::foo
    ::foo
    % interp slaves
    ::foo
    % foo eval set a
    can't read "a": no such variable
    
    For maximum surprise, move the first interpreter's command so that interpreters foo and ::foo can coexist:
    
    % interp create foo
    foo
    % interp eval foo set a abc
    abc
    % interp eval foo set a
    abc
    % rename foo moved
    % interp create ::foo
    ::foo
    % interp slaves
    ::foo foo
    % interp eval foo set a
    abc
    % interp eval ::foo set a
    can't read "a": no such variable
    % moved eval set a
    abc
    
  5. foundin changed to: "8.6.10"
  6. is_private changed to: "0"
  7. login: "kjnash"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "a774b1f5653dc3360e29ea7d635a64e94c9f1dab"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "kjnash"
  14. subsystem changed to: "20. [interp]"
  15. title changed to:
    Interpreter name resolution has problems with namespaces
    
  16. type changed to: "Bug"