in reply to Re: weak-reference set internally
in thread weak-reference set internally
Possibly, and thanks, will have to re-read in the morning when I'm more awake. I feel the isweak method may be the key.
To illustrate the original problem, consider a literal parent, with a child, modelled as 2 classes.
Obviously a parent can have a child, and the child can have that same parent, but that needs to be the weak reference.
When I have a parent and get the child, i store it within the parent, at the same time giving the child a reference back to the parent.
I now know I can always get to one from the other, and if they're not there, simply call a method to get them and store. hey presto, all fine and dandy.
My issue is where I get a child (not needing the parent yet), and WITHIN one of its methods I need to check a property of the parent, i can get the parent fine, check it's property fine, but i feel i should keep a reference so i don't have to get it again later.
Obviously since it's a weak reference from child to parent, it never stays in scope.
Surely that's kinda easy to understand my thoughts, maybe I'm going about it all wrong, but that's how things are starting to be modelled in the system I'm refactoring.
|
|---|