ce8b78a5
Continuation Passing Style
How does Kotlin rewrite /direct/ style to CPS
https://www.youtube.com/watch?v=YrrUCSi72E8 Roman Elizarov describes how they do implement the rewrite in the 1daf3860?cf compiler. Something unexpected for me is that they do it using a State Machine instead of doing it using callbacks, the reason being that with State Machines they do fewer allocations, since the same state machine is threaded through all the suspended functions.
How does C# rewrite Async functions
They follow a similar technique to Kotlin (or the other way around… IDK who was inspired by who)
https://www.codeproject.com/Articles/535635/Async-Await-and-the-Generated-StateMachine