On Sep 12, 2013, at 9:17 AM, Graham Cox <[email protected]> wrote:

> 
> On 12/09/2013, at 6:07 PM, Kyle Sluder <[email protected]> wrote:
> 
>> Personally, I would avoid doing this, as it could cause reentrancy among
>> KVO observers of eventTypes. Instead, I'd assign to mEventTypes directly
>> from your lazy initializer. Or perhaps I would factor out the common
>> setter code to a private helper method.
> 
> Indeed, I have changed the code to do just this, which is what I would have 
> written in the first place (honest!). I'm not sure why it wasn't and changing 
> it appears to have not caused any problems.
> 
>> Hopefully this has the side effect of shutting the analyzer up.
> 
> 
> It does.
> 
> I guess the thread is now really about why the analyser was thrown off by 
> this. Academic? Perhaps, but here's the bigger picture: I want to gradually 
> move my codebase to ARC, so in preparation for that, I have been going 
> through and trying to ensure the analyser is happy, since my understanding is 
> that ARC relies on the same analysis to do its thing correctly, so if the 
> analyser is getting it wrong, converting to ARC might introduce a bug here.


No, I don't think this is academic. The analyzer appears to have a real problem 
with using a setter inside a getter (both as exhibited with your original 
example and my more minimal example). If it is going to be responsible for 
adding all the memory management code to our code, we need to know that it can 
handle this situation or that it will refuse to convert to ARC when this 
situation is present. I'll try to see how it handles converting my minimal 
example to ARC.

Aaron  
_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to