FROM : Sherm Pendley
DATE : Thu May 08 18:28:25 2008
On Thu, May 8, 2008 at 12:09 PM, Christiaan Hofman <<email_removed>>
wrote:
>
> On 8 May 2008, at 5:50 PM, Sherm Pendley wrote:
>
> 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.
>
> The sentence I linked to and mmalc quoted clearly says 'contains "copy"',
> and this method name obviously contains the word "copy".
>
The linked-to sentence says "if you create it using a method whose name
begins with "alloc" or "new" or contains "copy"". You created the array
object with +alloc, and then sent it an -initWithObjects:copyItems.
Notice that I'm using the word "might"; what I'm saying here is that the
> description is not as clear as it could be.
>
It's crystal clear. You're not creating an object; you did that with +alloc.
What you're doing with -initWithObjects:copyItems is sending a message to an
existing object. So whether that message has "copy" in its name is
completely irrelevant to memory management.
> But the main point is what I said above, which would imply that the created
> array has an extra implicit retain
>
The -initWithObjects:copyItems: method doesn't create a new object, so the
presence of "copy" in its name implies no such thing.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
DATE : Thu May 08 18:28:25 2008
On Thu, May 8, 2008 at 12:09 PM, Christiaan Hofman <<email_removed>>
wrote:
>
> On 8 May 2008, at 5:50 PM, Sherm Pendley wrote:
>
> 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.
>
> The sentence I linked to and mmalc quoted clearly says 'contains "copy"',
> and this method name obviously contains the word "copy".
>
The linked-to sentence says "if you create it using a method whose name
begins with "alloc" or "new" or contains "copy"". You created the array
object with +alloc, and then sent it an -initWithObjects:copyItems.
Notice that I'm using the word "might"; what I'm saying here is that the
> description is not as clear as it could be.
>
It's crystal clear. You're not creating an object; you did that with +alloc.
What you're doing with -initWithObjects:copyItems is sending a message to an
existing object. So whether that message has "copy" in its name is
completely irrelevant to memory management.
> But the main point is what I said above, which would imply that the created
> array has an extra implicit retain
>
The -initWithObjects:copyItems: method doesn't create a new object, so the
presence of "copy" in its name implies no such thing.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net






Cocoa mail archive

