<@U5PGA5D34> Nothing prevents you from writing pro...
# announcements
e
@restioson Nothing prevents you from writing project/library with serializable coroutines -- all the core implementation classes (state machine impls) are designed to be serializable (they even implement java.io.Serializable marker for what it worth). As long as locals of each coroutine are serializable, you are good to go. Btw, what do you what to achieve?
h
@elizarov, maybe @restioson is thinking of implementing something like the Seaside Smalltalk webserver (http://seaside.st/). IIRC it has the async "call" being the sending of a web page to the client, and the "return" being the next request in a session-tied flow, which can be implemented as a single method (or nested method calls). I imagine you would serialise each continuation between response/request pairs if you didn't want them to use up memory and/or wanted them to survive a server restart.
r
I want to use it for scripting, where you can restart the coroutine from where it left off. I thought that they stopped implementing serializable, or at least I saw that on the issue for this (looks dead). Essentially I want to write scripts for games, e.g a scripted door/enemy.
If it still implements serializable, then I could try. Yeah, the thread locals should be serializable. Is there a way that I can access the underlying state machine?
e
They underlying state machine is available via
Continuation
reference that you get when you
suspendCoroutine
. Let’s move to #coroutines for further discussion. You can also ask question in the corresponding issue.
r
I wrote a code sample of an example use case for me https://github.com/Kotlin/kotlin-coroutines/issues/28
Right at the bottom
e
Noted. You can do right now if you use some 3rd party serialization solution (like Kryo)