FROM : Sherm Pendley
DATE : Thu May 08 17:50:28 2008
On Thu, May 8, 2008 at 11:16 AM, Christiaan Hofman <<email_removed>>
wrote:
E.g. initWithObjects:copyItems:. I couldn't find it in the ownership
> management docs, nor in the description of the method itself.
There's no special mention in the method docs, because none is needed - the
general rules apply to this method as-is.
> In fact, that description might make you believe that the objects from the
> array are copied, and therefore should be released by you!
If the array calls -copy on the items that you've added, then *it* is
responsible for balancing that -copy, *not you* - just like always. You
didn't send the -copy message, so you are not responsible for balancing it.
The inside of another object is Las Vegas - what happens there, stays there.
Trying to balance code other than your own is what gets a lot of newbies
into deep confusion.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
DATE : Thu May 08 17:50:28 2008
On Thu, May 8, 2008 at 11:16 AM, Christiaan Hofman <<email_removed>>
wrote:
E.g. initWithObjects:copyItems:. I couldn't find it in the ownership
> management docs, nor in the description of the method itself.
There's no special mention in the method docs, because none is needed - the
general rules apply to this method as-is.
> In fact, that description might make you believe that the objects from the
> array are copied, and therefore should be released by you!
If the array calls -copy on the items that you've added, then *it* is
responsible for balancing that -copy, *not you* - just like always. You
didn't send the -copy message, so you are not responsible for balancing it.
The inside of another object is Las Vegas - what happens there, stays there.
Trying to balance code other than your own is what gets a lot of newbies
into deep confusion.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net






Cocoa mail archive

