Tcl Source Code

View Ticket
Login
Ticket UUID: 934e6eb9cf15782433ffbc2f56cecdac30c596f5
Title: ensemble unknown handler confused by tailcall
Type: Bug Version:
Submitter: pooryorick Created on: 2020-01-03 20:04:41
Subsystem: 21. [namespace] Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2021-06-21 06:47:43
Resolution: None Closed By: nobody
    Closed on:
Description: (text/x-fossil-wiki)
<code>tailcall</code> confuses the unknown handler of a namespace ensemble.  The following
script,

<code><verbatim>
namespace eval ns1 {
    proc dispatch {routine args} {
        return list
    }
    namespace ensemble create -unknown [
    list ::apply [list {ensemble routine args} {
        tailcall dispatch $routine {*}$args
    } [namespace current]]]
}

puts [ns1 x one two three]
</verbatim></code>

results in the error:

<verbatim>
unknown subcommand "x": namespace ::ns1 does not export any commands
</verbatim>

However, if the word "tailcall" is removed, then the result is as expected:


<verbatim>
one two three
</verbatim>