How does Kotlin rewrite direct style to CPS
https://www.youtube.com/watch?v=YrrUCSi72E8 Roman Elizarov descrives how they do implement the rewrite. 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)