I don't agree, blocks are very powerful. I am using Xcode 4.6 and in a project that uses ARC it was throwing warnings when a block reference to a property caused a retain cycle. This is how I found it and why I mentioned it in another thread in the first place.
I haven't tested it extensively, but it looks as if the compiler recognises these situations easily and then tells you about it. So I wouldn't call blocks dangerous at all… Op Apr 25, 2013, om 10:21 AM heeft Tom Davie <tom.da...@gmail.com> het volgende geschreven: > > On 25 Apr 2013, at 09:34, Oleg Krupnov <oleg.krup...@gmail.com> 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 (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/diederik%40tenhorses.com > > This email sent to diede...@tenhorses.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com