Tcl Source Code

View Ticket
Login
Ticket UUID: 2549598
Title: [interp create] accepts empty path
Type: Bug Created on: 2009-01-30 16:47:50
Submitter: dgp Assigned to: aku
Subsystem: 20. [interp] Severity: Minor
Priority: 5 Medium Last modified: 2020-07-21 18:14:13
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: obsolete: 8.6b1.1
Description:
Several of the [interp] subcommands
treat the empty path as a name for
the current interp.

However, [interp create $path] does not
reject an empty list as an invalid $path
value, nor does it complain that the
current interp already exists.  Instead
it creates a slave interp which then
cannot be used.
User Comments:
kjnash added on 2020-07-21 18:14:13:
The names {}, {{}}, {{{}}} all refer to the contents of the outer pair of braces.

In 8.6.10 this misfeature still exists, but is a little different -
the slave can be used.  The interpreter command {} is created and
is usable, and the interpreter can be used with the interp command
by pretending its name is {{}}. 

It would be better if the "interp create" command refused to create
interpreter {}, and recognized it as the name of the current
interpreter.

% interp create foo
foo
% interp create {}
% interp slaves
{} foo
% lindex [interp slaves] 0
% {} eval pwd
/home/kjnash
% interp alias {{}} look {} bar
look
% proc bar {} {return {Main Interpreter}}
% {} eval look
Main Interpreter
% interp eval {{}} look
Main Interpreter
% interp eval {} look
look: bad usage
Try 'look --help' for more information.
child process exited abnormally
%

"interp" seems to have a general problem with list processing.  The command
    interp create {{}}
should create an interpreter named {{}} and it does, but in contexts
like "interp alias" this interpreter must be addressed as {{{}}}.