Internal and external iteration, fibers

Timon Gehr timon.gehr at gmx.ch
Sat Jan 19 18:45:00 PST 2013


On 01/19/2013 10:46 PM, Nick Sabalausky wrote:
> On Sat, 19 Jan 2013 09:45:25 +0100
> "qznc" <qznc at go.to> wrote:
>
>> On Friday, 18 January 2013 at 17:59:36 UTC, Nick Sabalausky wrote:
>>> Then there's C/C++ which has libs that offer what are known as
>>> "stackless fibers". These utilize the preprocessor, along with
>>> switch
>>> and goto, to accomplish the same thing that (AIUI) C# does for
>>> its
>>> coroutines: It lets the user write a normal coroutine, with a
>>> normal
>>> yield, which then gets trivially rewritten behind-the-scenes
>>> into an
>>> event loop (with NO actual fibers involved). I'm not sure to
>>> what
>>> extent this would be possible in D. If it is, the lack of
>>> preprocessor
>>> would probably make it much less nice-looking to use than the
>>> C/C++/C#
>>> versions. (Not that I'd want a preprocessor.)
>>
>> Is this also known as protothreads?
>>
>> http://dunkels.com/adam/pt/
>
> Yea. In fact, that's the exact same lib I've used.
>

This can be implemented a lot better looking in D. (My quick hack 
already looks better.) But I think we should first build a 
general-purpose DSEL library.


More information about the Digitalmars-d mailing list