Jeremias, Rhett,

I didn't realise that Reference objects were sexy, which seems to imply that was not my reason for being interested in them. Basically, Rhett, I was prompting for peoples' experiences, if any.

Jeremias Maerki wrote:
I didn't intend to kill that discussion with my response. I'm not a
specialist on those Reference classes but I've heard enough to say that
it can be tricky and should probably not be used just because it's sexy.
I'd vote for not using them unless there is a real good reason. I'm not
sure about your use case, but you might just have to do some research.
I'm sorry not to be more of a help.
Say I have a tree, one line of which looks something like this:

+---+---+-+---+-...-+---+
+->+->| 0 | P | | C | | C |
| | +---+---+-+---+-...-+---+
| | ^ | |
| | | +--+ +--...
| | | |
| | | v
| | +---+-+-+-+---+-...-+---+
| +--+-R | P | | C | | C |
| +---+---+-+---+-...-+---+
| ^ | |
| | +--+ +--...
| | |
| | v
| +---+---+-+---+-...-+---+
+-----+-R | P | | C | | C |
+---+---+-+---+-...-+---+
| |
+--+ +--...
|

etc., where C are the child references, P are the parent references and R are the root references, necessary in this case because the root of the FO tree has turned into a singleton with a lot of the common data used by properties and FO nodes.

Instead of using direct references for the C and P pointers, I have been thinking vaguely about using "some kind of" indirect reference - type unknown as yet. Ignoring R pointers for now, if I want to cache a subtree, the Reference objects seem to offer the possibility of indicating that the caching is required, and leaving the actual caching operation until GC demands it. If the "cached" subtree is accessed in the meantime, it should be pushed to the end of the caching queue. If the memory is reclaimed, the Reference object is alerted, and arranges to do the actual caching, then converts itself to a different kind of indirect reference, one which, when normally accessed, will arrange to retrieve the cached subtree, and reestablish it as a "pending".

These things just sound interesting - sexy, even, now that you mention it - though I doubt their sex appeal was a strong motive for creating them. The "raw" documentation doesn't really give much of a feel for their potential.

Peter
--
Peter B. West [EMAIL PROTECTED] http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



Reply via email to