miguel sofer wrote:
> OK, it was not clear at all :(
That's no problem. We have this discussion so things can be made clear. :-)
> The idea is that> yieldTo foo bar sum> will:> 1. suspend the currently running coro> 2. cause the coro's caller to invoke [foo bar sum] in the place of the > current coro, and take it's return value as the coro's return value> > IOW: it works EXACTLY like [tailcall] in the sense that the currently > running thing is removed from the call stack and replaced by a new > command. The difference is that where [tailcall] terminates the > currently running proc, [yieldTo] suspends the currently running coro.> > You can yieldTo any command, it can be a suspended coro but doesn't have > to be
So, the following should be equivalent, for any [foo]?
yieldTo foo bar
yield [foo bar]
Except that [foo] might see a different stack context? What will be the
cost of making a new short-lived context in the non-coro case? What will
[info coroutine] return inside the body of [foo] in the non-coro case?
Donal.
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Tcl-Core mailing list
Tcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-core