Subj : Re: Serializing Object Graphs To : Eric Brueggemann From : Brendan Eich Date : Tue Apr 08 2003 03:46 pm Eric Brueggemann wrote: >Brendan Eich wrote: > > >>Why would you want to use serialization for a "DOM undo" mechanism? >>Undo is easily implemented using a log of invertible operations. >> >>Mozilla's editor has multi-level undo. But maybe you're not using Gecko? >> >>/be >> >> > >Hi, > >Well, the DOM doesn't capture all the relevant information. I'd like >to be able to roll back JSObjects as well: > >obj.foo = "bar"; > >obj.foo = MD5(obj.foo); > >obj.foo == "bar"; > >It would also be very nice to be able to save state to disk for >restoration in a later process. > > Why do you want this, exactly? Serialization at the native object level requires cooperation by the native object's class or object-ops implementation (wherefore JSClass.xdrObject and JSObjectOps.xdrObject). But many classes do not fully implement these hooks. I doubt it's worth the effort trying to get all the native ones, just in the core engine, to do so. Then there are all the DOM ones. Invertible/transactional logging sounds better to me. But you'd still need to record all changes at a low level. Again, is it worth the high cost of implementation effort, and likely high cost in dynamic memory, and medium to low cost in code footprint? /be .