6 ms·
Nim CPS: compile-time continuations
- disruptek 3y agoAnother in the continuing discussion... CPS as a library using nothing more than Nim's meta-programming.
- disruptek 3y agoThis'll get you closer: https://github.com/nim-works/cps https://github.com/nim-works/cps Sorry, I was in a hurry.
- zevv 3y agoSo, what this is: it's a Nim macro that rewrites your regular procedural code into a continuation using the CPS transform; this offers you total power over the flow control of your code and allows you to build things like coroutines, async I/O schedulers, iterators, exceptions, all as first class citizens in the language. It has been under development for quite some time and is pretty much mature. Relevant recent articles: - https://without.boats/blog/let-futures-be-futures/ https://without.boats/blog/let-futures-be-futures/ - https://adam.nels.onl//blog/maybe-everything-is-a-coroutine/ https://adam.nels.onl//blog/maybe-everything-is-a-coroutine/