On Wed, Nov 4, 2015 at 10:09 AM, Jussi Kalliokoski <[email protected]> wrote: > I'm trying to come up with a solution to the problem of rendering lists [...] > My idea for a solution is that the lists are immutable, contain a reference > to their parent and a changeset / diff compared to their parent. [...]
Good problem, interesting idea. > The biggest problem is that this will leak memory like crazy; every revision > of the list will be preserved. OK. Perhaps obviously, the only way around this is to mutate the list, breaking the chain at a point where nobody cares about the rest of it anymore. The approach you've outlined is to have the GC tell you when to do the mutation, but why is that a good idea? You can do it deterministically in getLineage(). Maybe the concepts here would be clearer if we limited the graph to a single linked list. Then it looks a lot like a stream, in the functional reactive programming sense. Let the user (in this case, the renderer) buffer the diffs as needed; it knows when to reset the list. And no need for fancy data structures: it could just be an Array. -j _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

