[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Continuations




There are so many drawbacks to that technique that I don't think it is 
very useful in any practical situation. Doesn't deal with allocations 
and deallocations very well. Can't yield from the coroutine from a 
function called by the function. etc.

Duff's device is not even a good way to do what it was designed for, an 
inner loop, because it prevents code optimizers from doing instruction 
rescheduling across the case label boundaries. You do better with two 
loops, one unrolled and one for the remainder. Then the optimizer is 
free to do instruction scheduling in the unrolled loop.

On Tuesday, August 12, 2003, at 09:01 AM, Kimberley Burchett wrote:
> On Wed, 13 Aug 2003, Steven Shaw wrote:
>
>> Generators (like in Sather) are something I've always wanted in a
>> language-I-get-to-use-at-work. I've been reading how they can be
>> defined in Scheme using first-class continuations.
>
> Actually, continuations are overkill for generators.  All you really 
> need
> are coroutines, which can be simulated in C and C++ with the help of 
> some
> macros.  Check it out:
>
>     http://www.kimbly.com/blog/000054.html

-- 
--- james mccartney