digitalmars.D.learn - Yieldable function?
- Tofu Ninja (18/18) Aug 13 2015 Is there any way to have a yieldable function that can be resumed
- MrSmith (1/1) Aug 13 2015 http://dlang.org/phobos/core_thread.html#.Fiber
- Tofu Ninja (4/5) Aug 13 2015 Man I feel like I saw that before but when I went looking for it
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (5/10) Aug 13 2015 std.concurrency.Generator can present the yielded values as a range:
- Adam D. Ruppe (6/8) Aug 13 2015 it varies a bit across compilers (gdc does it differently), and
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.
Aug 13 2015
On Thursday, 13 August 2015 at 22:29:17 UTC, MrSmith wrote:Man I feel like I saw that before but when I went looking for it I couldn't find it. Didn't think to check in core. :/ Welp that solves my question, thanks :D
Aug 13 2015
On 08/13/2015 03:36 PM, Tofu Ninja wrote:On Thursday, 13 August 2015 at 22:29:17 UTC, MrSmith wrote:std.concurrency.Generator can present the yielded values as a range: http://ddili.org/ders/d.en/fibers.html#ix_fibers.Generator,%20std.concurrency AliMan I feel like I saw that before but when I went looking for it I couldn't find it. Didn't think to check in core. :/ Welp that solves my question, thanks :D
Aug 13 2015
On Thursday, 13 August 2015 at 22:27:31 UTC, Tofu Ninja wrote:Also how portable is the built in asm supportit varies a bit across compilers (gdc does it differently), and obviously across processors.Also is there a way to define naked functions in D?Put the `naked;` pseudo-instruction at the top of a function in an asm block. http://dlang.org/iasm.html
Aug 13 2015