pecan
pecan copied to clipboard
Macro-based coroutines for Haxe
```haxe @:pecan.accept function sync(?ret:pecan.Void->Void, ?co:pecan.ICo):pecan.Void { ret(Void); return null; } @:pecan.accept function async(?ret:pecan.Void->Void, ?co:pecan.ICo):pecan.Void { haxe.Timer.delay(() -> ret(Void), 10); return null; } function main() { pecan.Co.co({ sync(); trace("hallo"); async(); }).run();...
It should be possible to automatically generate the Haxe de/serialisation methods for a coroutine. It should be enough to store: - the state (CFG position + flags) - any state-crossing...
Add a way for macros to use pecan without the default API (`self`, `suspend`, `terminate`, etc). Could be an extra argument on `CoContext.build`.
`co.state` should indicate when the coroutine exited due to an unhandled exception.
I had an issue, I havn't yet resolved or narrowed down. Utilizing this function ```haxe @:pecan.accept static function sleep(ms, ?cb:Int->Void, ?co):Int { trace("sleeping"); Timer.delay(function() { trace("done sleeping"); cb(1); }, ms);...