Overview
| Artifact ID: | 70e9b7b80d979b59f90538ce023b7d6254d9fabe |
|---|---|
| Ticket: | 229fa655638ab16d794ea819296cf9f3a9088619
tailcall inside apply inside namespace |
| User & Date: | aspect on 2016-06-25 08:02:20 |
Changes
- icomment:
Isn't this expected? % namespace eval n0 { proc p0 {} { uplevel 1 {namespace current} } } % namespace eval n1 { puts [apply {{} {tailcall p0} ::n0}] } ::n1 The lambda body evaluates in a level in ::n0. [tailcall] looks up p0 in that context, finding ::n0::p0). Then the apply's frame is discarded and replaced with a new call. Thus {uplevel 1} doesn't find ::n0 because that level no longer exists - level -1 is where [apply] was invoked. It's unfortunate that: [uplevel 1 [list ::namespace origin [lindex [info level 0] 0]]] can fail to find a qualified name when used in a procedure that has been tailcalled. Prior to [tailcall], I believe this idiom was 100% reliable (?). If that is a significant loss, the only way I can see to restore it is if [tailcall] puts the fully-qualified name of the command on the stack .. but that might have other implications that break the utility of [lindex [info level 0] 0]. Meanwhile, I suspect [tailcall] already mixes badly with highly introspective procedures like this. - login: "aspect"
- mimetype: "text/plain"