Experimental command provided by [NRE], available in HEAD and onwards from the release of Tcl8.6a2. The command provides proper tailcalls, with the following semantics: * a proc/lambda invokes '''[[tailcall foo [[bar]] $soom]]''' * '''bar''' is invoked and the value of '''soom''' fetched, as if '''[[list foo [[bar]] $soom]]''' had been called * a command named '''foo''' is looked up ''in the current context'' * the current proc/lambda replaces itself in the call stack with a call to the just found command That is: '''tailcall foo [[bar]] $soom''' is very similar to '''return [[uplevel 1 [[list foo [[bar]] $soom]]]]''' with two exceptions: 1. '''foo''' is looked up in the ''current'' context, not in the caller's 1. the stack frame is ''really'' gone, not just ''virtually''. This has positive effects on memory, and a possibly confusing effect on stack traces. ---- [NEM] Many thanks to [MS] for his hard work making this a reality! For some background, see [Tail call optimization]. ---- !!!!!! %| [Category Concept] | [Category Control Structure] | [Category Functional Programming] |% !!!!!!