Overview
| Artifact ID: | 17dda15799c41723b1c19fe10cd09b8ff917655b |
|---|---|
| Ticket: | 1592212fffffffffffffffffffffffffffffffff
[interp alias] and [unknown] cannot work together |
| User & Date: | msofer on 2006-11-07 19:19:09 |
Changes
- assignee changed to: "msofer"
- cmimetype changed to: "text/plain"
- comment changed to:
(See also Bug 1444291; all of this also applies to ensemble redirection) The way unknown and namespace unknown work is: they get the full command line, do some reprocessing to determine or load the command that was not found, and then run the reprocessed command in [uplevel 1]. The return value of that upleveled command is then taken as the return value of the original. In order to function properly, this assumes that the level immediately above provides the right context for both command lookup and command execution. But alias targets should be looked up in the global context, and then executed in the caller's context. The scriptlet below is wrong (result of calling a command directly or thorugh an alias should be the same), but the alternative (previous to fixing 1444291) would also be wrong, as can be seen in that bug report. % proc unknown args {uplevel 1 namespace current} % interp alias {} y {} x y % x :: % y :: % namespace eval a x ::a % namespace eval a y :: One possible (incomplete) solution is for aliases to always call their target with a FQ name, so that [unknown] does not care if [uplevel 1] provides the wrong resolution context. This can be salvaged in the core, but who knows what might happen with custom unknown procs that override ::unknown. Another alternative is for aliases not to call unknwon when they do not find their target, as was the case in Tcl7.6. Note that [namespace unknown] is almost impervious to this: the only way to have a non-global command be an alias target is by providing a qualified name (that is interpreted as rooted in :: even if not FQ). So an alias target can only call the global namespace's unknown. - foundin changed to: "obsolete: 8.5a6"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "msofer"
- subsystem changed to: "45. Parsing and Eval"
- title changed to: "[interp alias] and [unknown] cannot work together"
- type changed to: "Bug"