Fork me on GitHub

Would it be possible in principle to serialize/deserialize SCI's state (to pause/resume computations)?


@wombawomba I think someone has tried this once with nippy and one of the issues was circular references within the state.


Alright! If I wanted to give it a shot, how should I go about it?


essentially, you have a cyclical graph. there are many ways to represent a cyclical graph. I might suggest either EAV approach like datomic or just a graph approach with nodes and edges.


@wombawomba one of the problems is: how to persist functions. Red Planet Labs has some tricks for this which I recommended the last time someone tried this. Unfortunately I can't find the conversation anymore.


One limitation of red planet labs solution is that it depends on eval. So it does not work with GraalVM. Otherwise, it works very well. For Datalevin, I had to use a special macro for serializable functions to send over the wire to the server.


Specter also relies on eval but I was able to patch specter to use SCI for eval to make it work with GraalVM. Perhaps the same can be done for this?


i remembered i tried that but it did not work. Forgot the reason, maybe it was the methodHandle stuff


The SCI context is essentially a map with an atom with a map inside of that. All of the things you wanted to save should be serializable somehow.


Hmm, perhaps @mkvlr also have some ideas about this since it's pretty similar to what Nextjournal is doing perhaps with Clerk.