yieldm

yieldm was located in ::tcl::unsupported in beta releases of Changes in Tcl/Tk 8.6. Later, yieldto was modified such that it became trivial to implement yieldm in terms of it. Thereafter, ::tcl::unsupported::yieldm was removed.

Synopsis

::tcl::unsupported::yieldm ?value?

Description

yieldm is like yield, except that the next time the the associated coroutine context command is executed, it behaves like a procedure whose argument specification is the single special value, args. I.e. the coroutine context accepts an arbitrary number of arguments, and the return value of yieldm is a list of those arguments. yieldm is no-longer a built-in command, but can be implemented like this:

proc yieldm {{value {}}} {
    yieldto return -level 0 $value
}

In this implementation, any command that simply returns $value could be used instead of return:

proc yieldm {{value {}}} {
    yieldto lindex $value
}

DKF: I'd rather use string cat for this:

proc yieldm {{value ""}} {
    yieldto string cat $value
}

Discussion

AMG: Is any progress being made towards officially adopting this command or a variation thereof?

MS did not see any: no TIP, no requests