Re: ^Block statement considered harmful for callbacks?
Re: ^Block statement considered harmful for callbacks?
- Subject: Re: ^Block statement considered harmful for callbacks?
- From: Tom Davie <email@hidden>
- Date: Thu, 25 Apr 2013 10:21:47 +0100
On 25 Apr 2013, at 09:34, Oleg Krupnov <email@hidden> wrote:
> Tom, I disagree, because unlike other objects with strong refs, or say
> @property(retain), the strong refs in blocks are created implicitly
> and it's just too easy to let them slip out of attention. There is no
> direct command to create the strong ref, unlike @property(retain). All
> you do is *mention* self or even an ivar, and voila, you're done.
>
> I wish there was a safe and elegant solution to this, like we did with
> proxy for NSTimer.
I'm not really convinced that the fact that these objects are easier to dynamically create makes the problem that retain counting inherently can't deal with retain cycles any worse.
That said, I wonder if the correct solution to what some are clearly finding an issue here is to look to the compiler. At least superficially, I could see it being possible to detect a lot of cycles with a static analyser. Obviously you couldn't detect all of them, but this would probably get a good way to stomping on the "you used an ivar here, and self retains the block, that's bad m'kay" bugs.
Thanks
Tom Davie
_______________________________________________
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