Re: Managing Retain/Release for a ContentView
Re: Managing Retain/Release for a ContentView
- Subject: Re: Managing Retain/Release for a ContentView
- From: Tim Hart <email@hidden>
- Date: Tue, 12 Aug 2003 14:30 -0500
___
Sent with SnapperMail
www.snappermail.com
...... Original Message .......
On Tue, 12 Aug 2003 20:52:48 +0200 Dietmar Planitzer <email@hidden>
wrote:
>
In Cocoa, de facto every method which takes an object as an argument is
>
supposed to retain or copy it. More or less the only exception to this
>
rule is -setDelegate: which does not retain the passed in object.
I'll have to take exception to this statement. With regard to the initial
question, you are absolutely correct. In general, though, the statement
does not hold water. The AppKit API is full of methods which take object
arguments that don't require you to retain those arguments at all. My
personal style of OO development will use objects as contextual information
to a method. I do not need those objects beyond the method in question, and
I do not need to retain such objects.
However, if the argument is an object, and the method sets an attribute to
that object, then yes, you must retain those objects. Of course, there is
even an exception to that rule - if the object is metaphorically cosidered
to be a 'parent' of the receiver
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.