Does D have anything like the generators of Python and some other languages?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 29 15:03:35 PDT 2016


On 08/29/2016 02:50 PM, A D dev wrote:
> On Monday, 29 August 2016 at 21:28:15 UTC, Cauterite wrote:
>> Ranges serve some of the purposes that generators are often used for:
>> http://dlang.org/phobos/std_range.html
>>
>> But you can of course make true coroutine-based generators with
>> fibres: http://dlang.org/phobos/core_thread.html#.Fiber
>
> Thanks. Both sound interesting. Will check.
>

Here is an example of a generator fiber:

 
http://ddili.org/ders/d.en/fibers.html#ix_fibers.Generator,%20std.concurrency

Ali



More information about the Digitalmars-d-learn mailing list