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

Cauterite via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 29 14:28:15 PDT 2016


On Monday, 29 August 2016 at 21:24:52 UTC, A D dev wrote:
>
> Hi group,
>
> Does D have anything like the generators of Python and some 
> other languages?
>
> Thanks.

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

"fibre" is basically a synonym of "coroutine".


More information about the Digitalmars-d-learn mailing list