06/12/2017, 9:00 PM
@groostav The documentation on
gives an answer: There are lots of good explanations on the web as to why in JS world it is a standard to always schedule execution of async operations for later, as opposed to executing them immediately on stack (in short, it causes lots of subtle problems down the road that do not worth minor performance improvement it gives)


06/15/2017, 4:59 AM
but this subtle and context-sensitive difference in behavior makes the resulting async code harder to debug.
It leads to recommendations like "use yield if you need to ..."
I'm genuinely curious, can you link me to this? I've never heard this said. And my counter-example is that if we have an eager-check then I can take UI code, written with `suspend fun`s, which expects to call expensive services that are instead mocked out with fake fast-running stubs, and have everything run sequentially. This is a big win for testing and debug ability. Consider the stack-trace on in-line-dispatched jobs.
I'm googling around in C# coroutines and interestingly enough one of the bigger use cases seems to be with unity (the game engine)