Hacker News new | ask | show | jobs
by aportnoy 1098 days ago
Everything is an object that is either a cons cell or an atom. Associate the address of each object with a unique index.

Serialize each object as a pair (index, obj), where 'index' maps back to the original address where the object was stored, and 'obj' is a pair of indices if the object is a cons cell, or the appropriate representation (string literal, integer, etc.) if the object is an atom.

Then to deserialize allocate a memory location for every index and load the objects as is. Then replace the indices with the corresponding (new) addresses.

1 comments

This definitely isn't "printing" in the original sense, just a serialization algorithm.