On Wed, Jun 17, 2009 at 6:48 PM, Nathan Vander
Wilt<[email protected]> wrote:
> Isn't it acceptable practice to let a container object I hold to maintain
> its objects on my behalf?

Not explicitly, no.  Take -[NSWindowController delegate], for example.
 Because delegates are a weak reference, the contract is explicit that
your delegate must always be valid from the time you set it to be so
to the time the NSWindowController instance is deallocated *or* you
call -setDelegate: with a different object.  It's this explicit
contract which lets NSWindowController not have to wrap all accesses
to its delegate with -retain/-release calls.

In the specific context you illustrate, you're violating the
rule-of-thumb that once you release an object for good you don't
message it again.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to