Hacker News new | ask | show | jobs
Nim CPS: compile-time continuations (github.com)
3 points by disruptek 853 days ago
3 comments

So, 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://adam.nels.onl//blog/maybe-everything-is-a-coroutine/

This'll get you closer: https://github.com/nim-works/cps

Sorry, I was in a hurry.

Another in the continuing discussion... CPS as a library using nothing more than Nim's meta-programming.