The Object Model in Livelymerge
In the Livelymerge project, Dan Ingalls, Peter Van Hardenberg, and Alex Warth are exploring the utilization of an Automerge document as the heap for a program. This creates a persistent, shared heap similar to a Smalltalk image, allowing for persistence and collaboration among users. The object model designed and implemented for this project automatically serializes and deserializes data from/to the Automerge document.
This enables self-sustaining systems like Squeak and the Lively Kernel, which can be modified by users in real-time, while maintaining persistence and collaboration. LM programs are written in ordinary JavaScript with objects, arrays, closures, and class syntax functioning as expected. However, their state is represented within the associated Automerge document instead of the JavaScript heap.
This ensures that objects are persistent and support collaboration. Global variables, such as f, are stored in the program’s heap, allowing for persistence and shared state across users. Closures, like the counter example, also benefit from this persistent and shared state, as their free variables are stored in a heap object. The object model allows for cycles in the heap, but it must be serialized into a JSON-like AM document with UUIDs for object identification, enabling the benefits of Automerge's array merge semantics for arrays in the object model.
Property values can reference other objects or even themselves, enabling complex data structures. The global object serves as the root of the LM heap, and its properties are accessed through proxies that maintain the desired persistence and collaboration.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — it may contain errors, so check the original before relying on it.