[racket-dev] Coroutines (mzlib/thread)

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Sat Jul 21 14:41:50 EDT 2012

On 2012-07-20 21:48:38 -0400, Matthias Felleisen wrote:
> We can build it for real. Both interfaces have separate uses and
> should be kept separate. -- Matthias

My first thought was that these could be provided by the same interface,
but let me see if I understand what you're saying.

The issue with providing both options, is that if you provide an `yield`
operator to implicit co-routines, you take away the ability to place
all control of yielding from the controller.

So couldn't we provide a version of `coroutine-run` that takes a #:yield
keyword that enables/disables explicit yielding? If #:yield is off, then
the `yield` procedure provided to the coroutine would be a no-op. Only
the implicit yield condition would trigger a context switch.

Otherwise, the procedure would yield and run some default scheduler.


Posted on the dev mailing list.