#3313 Unexpected error when aliasing undefined command

obsolete: 8.4.11
closed-invalid
5
2005-11-27
2005-11-27
Anonymous
No

use an alias for undefined procedure
---
(bin) 1 % interp alias {} xxx {} xx
xxx
(bin) 2 % xx
too many nested evaluations (infinite loop?)
(bin) 3 % xxx
too many nested evaluations (infinite loop?)
---
but
---
(bin) 1 % interp alias {} xxx {} yy
xxx
(bin) 2 % yy
invalid command name "yy"
(bin) 3 % xxx
invalid command name "yy"
---

(bin) 4 % info patchlevel
8.4.11
(bin) 5 % parray tcl_platform
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine) = intel
tcl_platform(os) = Windows NT
tcl_platform(osVersion) = 5.1
tcl_platform(platform) = windows
tcl_platform(user) = oleinickoa
tcl_platform(wordSize) = 4

Discussion

  • miguel sofer

    miguel sofer - 2005-11-27
    • assigned_to: hobbs --> msofer
    • status: open --> closed-invalid
     
  • miguel sofer

    miguel sofer - 2005-11-27

    Logged In: YES
    user_id=148712

    This is not really a bug, and [interp alias] has nothing to
    do with it. It is the autocompletion in the interactive
    tclsh playing tricks on you. Look at the following session:

    % interp alias {} xxx {} xx
    xxx
    % xx
    too many nested evaluations (infinite loop?)
    % proc xxAHA! {} {}
    % xx
    ambiguous command name "xx": xxAHA! xxx

    What is happening in your case is:
    (1) you invoke a command named xx (directly)
    (2) no such command; autocompletion sees that there is a
    unique command (xxx) starting with xx, and invokes it
    (3) xxx invokes xx: goto 1.

    Note also that you see the correct error if the script is
    sourced from a file, as the autocompletion does not work in
    that case:

    mig@uhu:~$ cat /tmp/test
    interp alias {} xxx {} xx
    xx
    mig@uhu:~$ tclsh /tmp/test
    invalid command name "xx"
    while executing
    "xx"
    (file "/tmp/test" line 2)