coroinject
coroinject coroName cmd ?arg ...?
Puts a command in a suspended coroutine. At the next resume the command runs in the coroutine, with two more arguments: the name of the command that suspended it (yield or yieldto) and the value of the resume. Its result is the result of that yield or yieldto. A command put in later runs first, and its result is the value of the next one.
Examples
coroutine c apply {{} {return [yield]}}; coroinject c apply {{op v} {string toupper $v}}; c higivesHI
Errors
coroinject nope set xgives the errorcan only inject a command into a coroutine
Facts
- Capability: none.
- Compute cost: one compute unit for the call, and more for the commands that it runs.
- Release: Tcl 9.1 only. A script has the command when ztcl follows Tcl 9.1, with
--tcl 9.1. See Tcl 9.1.