[XML-SIG] DOM and Proxies

Ken MacLeod ken@bitsko.slc.ut.us
18 Feb 2000 14:07:42 -0600

"Andrew M. Kuchling" <akuchlin@mems-exchange.org> writes:

> Paul Prescod writes:
> >Opinions? I would actually sneak this class into a C-coded minidom
> >library (built directly on top of expat) for use by anyone who knows it
> >is there.
> Open question: is the proxy mechanism still useful if a garbage
> collection mechanism for collecting cycles gets into 1.6?  (Neal
> Schemenauer is working on something, but it's too early to tell if
> it'll get into 1.6; perhaps the cost will be too high.)

Probably not needed purely for GC reasons.

> Maybe you'd use it for performance reasons, to save the GC some work,
> making less trash for it to scan through, but then you're losing a
> tiny bit of performance from the extra indirection on every access to
> the object.  My concern is simply to avoid spending time building
> something that turns out to be unneeded.

Probably not a performance boost either, a GC would still likely scan
all the objects and using proxies would actually add more objects to
be scanned.

> If cyclic trash was collected, would you still need a proxy mechanism?

I'd like to offer up a different reason for using proxies: to remove
the concept of "ownership" from fragments of the tree so that they can
be shared by multiple processing steps.

It's not clear to me why the DOM processing model has such a strict
concept of "owning document".  To a lesser extent, a lot of data
models use parent references because the data is inherently hierarchic
but ignore the usefulness of being able to share tree fragments
between different trees.

I have found proxies to be very good at providing the illusion of
heritage while in reality allowing fragments to be shared among trees.

  -- Ken