On Apr 11, 2007, at 12:11 UTC, Daniel Stenning wrote: > It is good to have this new feature, but since Parent-Child > relationships are found all over the place ( at least in my code they > are ) and the scenarios presented seem to me anything but "rare" - am > I alone in thinking that the way this feature was implemented is a > "fudge" ? :
No, but I would say that extensive use of WeakRef in your situation would be a kludge and (I predict) will cause you grief. I would recommend a Close (or ReleaseData or Cleanup or whatever) pattern instead. > a) because it loses the typing information - it is generic for all > objects. This adds to tedium as one has to apply lots of casting. Not if you properly hide it, say inside a computed property. > b) the amount of coding involved to create and deal with this object. Foo. See above. Neither of these is a serious problem, IMHO. Actually, now that I think about it, maybe using WeakRef in a clean parent/child hierarchy isn't so bad after all. Just be sure the semantics are clear -- the parent owns the children, and the children have only a weakref to the parent. What makes me nervous about extensive use of WeakRef is that people often end up with very fuddled semantics, and lose their last real reference before they're prepared for it, and end up with NilObjectExceptions. But in a nice clean design, of course that can be avoided. Best, - Joe -- Joe Strout -- [EMAIL PROTECTED] Verified Express, LLC "Making the Internet a Better Place" http://www.verex.com/ _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
