Re: Properties, Attributes and Retain+Autorelease
Re: Properties, Attributes and Retain+Autorelease
- Subject: Re: Properties, Attributes and Retain+Autorelease
- From: Kyle Sluder <email@hidden>
- Date: Wed, 29 Jun 2011 11:51:04 -0700
On Wed, Jun 29, 2011 at 10:39 AM, Markus Hanauska <email@hidden> wrote:
> Yes, it talks about certain*exceptions*, and you are right, one of them is in fact destroying the parent, so I'm wiling to accept that you must not rely upon an object to stay alive longer than its parent. However, have you also read the top paragraph?
>
> "Cocoa’s ownership policy specifies that received objects should typically remain valid throughout the scope of the calling method. It should also be possible to return a received object from the current scope without fear of it being released. It should not matter to your application that the getter method of an object returns a cached instance variable or a computed value. What matters is that the object remains valid for the time you need it."
>
> This principle is violated by a getter returning an object that is not retain+autorelease, since even without destroying the parent the returned object might go away. As pointed out in my other mail:
Yes, but all of this is already well-known. FWIW, nothing about atomic
guarantees that the object is returned retained/autoreleased.
All of your criticisms are valid, but they're the precise criticisms
that ARC addresses.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden