Re: ARC [was Protecting against "app nap"]
Re: ARC [was Protecting against "app nap"]
- Subject: Re: ARC [was Protecting against "app nap"]
- From: Roland King <email@hidden>
- Date: Thu, 12 May 2016 16:39:16 +0800
I can’t imagine going back to manual retain release. ARC lifted hours of work away from writing code because you just use objects and they stay when they need to stay go away when you’re done with them. I see hardly any questions about ARC at all, there were some at the very start, but they petered off pretty fast, that’s because it basically just works. There are a couple of things you need to know, how to avoid retain cycles with blocks (and the compiler warns you normally and Swift requires explicit selfs and warns you) and the annotation to keep objects alive through a scope which we discussed here the other day. That’s basically it, know those two things and it just works. The tools for debugging retain cycles are very good too, so if you do get one, it’s pretty easy to find it.
ARC is 1000x more usable than manual retain release, and now it’s mature, I can’t think of a good reason not to use it.
> On 12 May 2016, at 16:16, Jonathan Taylor <email@hidden> wrote:
>
> Hi Jens,
>
> Thanks again for your reply. I'm sure this has been done to death over the years on the list, but... you would definitely recommend ARC then, would you? I've been a bit put off by what seems like regular questions on the list(s) about debugging and fixing edge cases where ARC doesn't work. I guess that only shows the times when it doesn't work, but it's rather left me thinking that it's just the same, but with less explicit indication of what is going on. Is that an unfair assessment, in your view?
>
> Best regards,
> Jonny.
>
> On 11 May 2016, at 16:10, Jens Alfke <email@hidden> wrote:
>
>>
>>> On May 11, 2016, at 2:31 AM, Jonathan Taylor <email@hidden> wrote:
>>>
>>> I guess I just found method naming a bit odd (not really referring to an object at all), and might have expected it to have an ‘alloc/new’ naming since I’d have thought the API would be almost exclusively used for activities that continue beyond the calling scope.
>>
>> The only methods named +alloc or +new are the core methods on NSObject that instantiate objects. (There’s also -copy and -mutableCopy.) Regular methods don’t use that naming scheme nor return owned references, they just consistently return unowned references. That keeps the rules simpler.
>>
>> (And I really recommend using ARC! It saves trouble and eliminates a lot of bugs, like this one.)
>>
>> —Jens
>
> ___________
_______________________________________________
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