Overview
| Artifact ID: | 38941f20d51d7434510b508754274f8dacef960a |
|---|---|
| Ticket: | 3048771fffffffffffffffffffffffffffffffff
tailcall constraints chafe with control command procs |
| User & Date: | dgp on 2010-08-19 16:20:31 |
Changes
- assignee changed to: "msofer"
- cmimetype changed to: "text/plain"
- comment changed to:
A celebrated feature of Tcl is the ability to replace built-in commands with functionally equivalent procs. The constraints on [tailcall] diminish that ability. Utility command from TIP 90: % namespace eval control { proc ascaller script { if {[info level] < 2} { return -code error \ "[lindex [info level 0] 0] called outside a proc" } variable result variable options set code [uplevel 2 \ [list ::catch $script [namespace which -variable result] \ [namespace which -variable options]]] if {$code == 0} { return $result } dict incr options -level 2 return -options $options $result } } % proc myIf {cond body} { set bool [control::ascaller [list ::expr $cond]] if {!$bool} return return [control::ascaller $body] } % proc good {} {if 1 {tailcall concat}} % good % proc bad {} {myIf 1 {tailcall concat}} % bad tailcall can only be called from a proc or lambda - foundin changed to: "None"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "dgp"
- subsystem changed to: "45. Parsing and Eval"
- title changed to:
tailcall constraints chafe with control command procs
- type changed to: "Bug"