W3C home > Mailing lists > Public > www-dom@w3.org > April to June 1998

Re: Hello and NodeIterator Revisited

From: Craig Brozefsky <craig@duomo.onshore.com>
Date: 05 May 1998 02:33:55 -0500
To: "Don Park" <donpark@quake.net>
Cc: <www-dom@w3.org>
Message-ID: <8790ohf9y4.fsf@duomo.onshore.com>
"Don Park" <donpark@quake.net> writes:

> >Urk, I'm scared by the prospect of memory mgmt issues perculating up
> >into the DOM API.  Is it really impossible to implement it without
> >unused NoteIterators piling up?  Is it also really neccesarry to keep
> >track of NodeIterators in the Node?  
> You are making as much sense to me as a green lieutenant telling a
> battle-proven sergeant how to make war in the middle of a battle.  No
> offense to the lieutenant.

No offense intended.  Those were not rhetorical questions, or
expressions of doubt in your effort or anything like that.  Perhaps I
should have qualified it by saying instead, "Is it really impossible
to implement <blah> without <blah> happening, or is there a way, but
that way madness and hackery lies?"  It's genuine curiosity and
interest because I'm dealing with the same problems myself, just
a different language.

> >> 1. Please add 'release' method to NodeIterator.
> >
> >Memory/Storage Mgmt. in this API would be an incredible mistake.
> Please show me where the mistake is in detail.  It would even more helpful
> if you could show me a way to implement all the requirements of DOM in Java
> without using 'release'.

I think we should avoid making users responsible for memory mgmt.  I
also don't think it's a requirement for implementations, nor directly
useful to users.  It's another place to introduce bugs, which novice
scripters seem very capable of tripping, by early releasing, or not
releasing at all.

I really like the way you put the ContainerIterator into the Node to
model the "betweeness".  But instead of putting the NodeIterator into
the ContainerNode, put a "point" into the list.  And then give that
"point" to the NodeIterator.  Then you no longer have a reference in
the ContainerNode to the NodeIterator so it can go out of scope now
when the user is done with it and in the destructor you can tell it to
remove it's "point" from the ContainerNode.  Then the NodeIterator just
uses that "point" the same way it used itself previously to navigate
within it's parent ContainerNode.  Of course, this just moves the
issue of "release" into another object behind the scenes.  Does this
not allow you to get rid of "release" in the NodeIterator interface?
I have not implemented this, I could be missing something.

Am I shredding my Java cred? 8^)
Received on Tuesday, 5 May 1998 03:30:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:04 UTC