Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-04-22
20:54 • Closed ticket [546985ffff]: interp alias endless loop plus 9 other changes artifact: 458184e219 user: dgp
16:25 • Ticket [546985ffff]: 4 changes artifact: 1065887b8f user: dkf
08:03 • New ticket [546985ffff]. artifact: 4224d54b52 user: nobody

[interp alias] endless loop

Closed / Duplicate546985ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-04-22 08:03:29
OS platform and version: Windows 2000

Problem behavior:
With [interp alias] one can override built-in or 
otherwise defined commands, also in the current 
interp. But after deleting an alias, neither is the 
original name visible again, nor an error raised for 
unknown command; instead, an endless loop is reported 
that the coder does not feel guilty of. (Richard 
Suchenwirth)

Expected behavior:
I'm not sure which from reading man interp, but I 
would expect one of
(1) original command visible again (preferrably); or
(2) "unknown command set"

Concise code sample:
% interp alias {} set {} puts stdout
set
% interp alias {} set
puts stdout
% set 5
5
% interp alias {} set {}
% interp alias {} set
% set i 5
too many nested calls to Tcl_EvalObj (infinite loop?)
dkfplain2002-04-22 16:25:35
Logged In: YES 
user_id=79902

This destroys the [set] command, and that blows up [unknown]
unsurprisingly.  Aliases are commands...

IMHO this comes under the heading of "Doctor, it hurts when
I shove a fork in my eye!" "Stop shoving forks in your eye."
dgpplain2002-04-22 20:54:56
Logged In: YES 
user_id=80530

This is a duplicate of Bug 217997.

The default [unknown] expect some built-in Tcl
commands to exist and have their original definitions.
When that is not true, very strange things can happen.

To some extent, this problem could be reduced by
putting Tcl's built-in commands into the ::tcl
namespace, but you can't make it go away completely,
and still have Tcl be Tcl.
Log in (anonymous is fine) to add a comment.