acton icon indicating copy to clipboard operation
acton copied to clipboard

Expose (de)serialization function

Open plajjan opened this issue 2 years ago • 2 comments

We have the ability to serialize everything internally. We should expose functions to serialize and deserialize objects so that we can send them across sockets or write to files. Very handy!

plajjan avatar Jan 07 '24 16:01 plajjan

@nordlander is it safe to deserialize actors?

The way we do deserialization in RTS is for the entire Acton program and we only do it once. By exposing a deserialize() function, the user can call it many times. If the serialized data is just some objects, it's easy to see how we will just get multiple instances of those objects. But what if it is one or more actors? Will we just get more actors? What if it is the Env actor?

The use case for serialization thus far has only covered objects, so limiting these functions to objects and throwing an exception if we get an actor in the stream would be an option.

What do you think?

plajjan avatar Feb 22 '24 12:02 plajjan

An actor reference is just serialized as the globkey of that actor, so in that aspect, serialization is safe.

nordlander avatar Feb 22 '24 12:02 nordlander