Yieldable function?

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 13 15:27:29 PDT 2015


Is there any way to have a yieldable function that can be resumed 
at a later time in D?

Some thing like:

void test()
{
      writeln("A");
      yeild();
      writeln("B");
}

...

auto x = yieldable!test();
x.resume(); // prints "A"
x.resume(); // prints "B"
x.resume(); // throws an error or something, i dont know..


Also how portable is the built in asm support, was thinking about 
implementing this if it's not already available. Also is there a 
way to define naked functions in D? I think not but they might 
make implementing this a little more simple.


More information about the Digitalmars-d-learn mailing list