Pepe's Braindump

Continuation Passing Style

Programming Languages


How does Kotlin rewrite direct style to CPS 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.

Kotlin suspend

How does C# rewrite Async functions

They follow a similar technique to Kotlin (or the other way around… IDK who was inspired by who)

Cortex theme by Jethro Kuan. Built with org-mode, org-roam and Hugo