Re: Use of weak reference in non-circular reference situation
Re: Use of weak reference in non-circular reference situation
- Subject: Re: Use of weak reference in non-circular reference situation
- From: Eric <email@hidden>
- Date: Wed, 31 May 2006 11:58:41 -0700
Yes, aArray doesn't care whether A is retained or even the fact that it's
retained by A. But I'm just saying that in this particular example, the
programmer knows and assumes aArray will be around as long as A exists in
memory, and therefore it's safe to have aObject be a weak reference to
aArray (since aObject is an ivar of A and will only be used when A exists in
memory). It's just assumption in a special case, not a general case.
On 5/31/06, John C. Randolph <email@hidden> wrote:
On May 31, 2006, at 3:14 AM, Eric wrote:
> Since aArray is not
> deallocated until Object A is deallocated,
It's not clear why "aArray" should know or care whether A is
deallocated. The usual semantics are that an NSArray retains its
contents, and releases them when they're removed or the array itself
is deallocated. Whether anything else has retained A shouldn't
matter to "aArray" at all.
-jcr
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden