Is it a valid statement to say that with context parameters you can actually recreate the suspend keyword? I mean, the suspend keyword provides a Continuation, but with context parameters you can provide a Continuation context.
j
JP Sugarbroad
05/07/2025, 6:16 PM
Not really? The suspend keyword's primary purpose is to do the CPS transform so you don't have to handle continuations explicitly
a
Arjan van Wieringen
05/07/2025, 6:32 PM
Ah okay, there happens a lot more under the hood than passing a simple continuation of course
d
Daniel Pitts
05/10/2025, 2:54 AM
In particular, it converts the function from imperative to a state machine. Whenever a suspend function calls into another suspend function, it can be told to return immediately. The function will be called again with its new state once the function is resumed.