Re: Who owns a child view controller?
Re: Who owns a child view controller?
- Subject: Re: Who owns a child view controller?
- From: Jeremy Hughes <email@hidden>
- Date: Wed, 12 Jul 2017 18:57:53 +0100
> On 12 Jul 2017, at 18:38, Charles Srstka <email@hidden> wrote:
>
>> On Jul 12, 2017, at 12:23 PM, Jens Alfke <email@hidden> wrote:
>>
>>> On Jul 12, 2017, at 9:54 AM, Jeremy Hughes <email@hidden>
>>> wrote:
>>>
>>> I’d forgotten about autorelease pools - but I guess they’re still there in
>>> Cocoa for backwards compatibility with pre-ARC code.
>>
>> Autorelease is still necessary with ARC. There are cases where ARC doesn’t
>> know enough about object lifetimes at compile-time, and has to e.g.
>> autorelease a temporary object before returning it from a method.
>
> While that’s true, the main reason, as I understand it, that ARC doesn’t know
> enough about the object’s lifetime is that non-ARC code may be calling the
> method. In an all-ARC world, a method could always just return objects with a
> +1 retain count, and the consumer could just assume that and always balance
> the retain.
Wouldn’t it be ARC (rather than the consumer) that is balancing retains?
I’ve never used autorelease in native Swift code.
Jeremy
_______________________________________________
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