On Jan 31, 2012, at 3:49 PM, R wrote:

> David,
> Class B is a parser.  It is passed NSData to parse (weak reference)
> and the Array (weak reference) from Class A.  The results of the Data
> parse are placed into the Array.  Class A will be around for the life
> of the application.  Class B will be released (set to nil) after
> completing the parse.
> I chose this approach rather than delegation.
> 
> Thoughts?

I'm not seeing why you use weak references. ClassB wants to hold on to its data 
until it's done processing it; that seems like it should be a strong reference, 
regardless of how long you expect the ClassB object to live. Weak references 
are for avoiding retain cycles between two objects that need to refer to each 
other, or for cases where it's OK for an object to go away if nothing else is 
using it.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to