Re: Could somebody please fix NSTimer?
Re: Could somebody please fix NSTimer?
- Subject: Re: Could somebody please fix NSTimer?
- From: Charles Srstka <email@hidden>
- Date: Mon, 14 Jan 2013 13:49:43 -0600
On Jan 14, 2013, at 1:23 PM, John McCall <email@hidden> wrote:
> On Jan 14, 2013, at 10:07 AM, David Duncan <email@hidden> wrote:
>> On Jan 12, 2013, at 10:49 AM, Gordon Apple <email@hidden> wrote:
>>
>>> When compiled under ARC, NSTimer should have a weak, not strong, reference to its target.
>>
>> If you want this, file a bug. Posting on the mailing list isn't guaranteed to get your request anywhere close to the persons responsible for evaluating and implementing features.
>>
>>> When the timer starts to fire, check the reference for nil and invalidate itself. Come on guys, how hard is that?
>>
>> Probably harder than you give credit for, given that the framework has to work correctly for MRR, ARC and GC (where "correct" is subtly different for each environment) as well as support existing applications of each of these flavors that wouldn't know about this new behavior.
>
> It is effectively impossible: unlike GC, ARC is not a new runtime environment. Different NSTimers may be used from different parts of the program that are compiled under different settings — most likely, a system framework compiled under MRR and an executable compiled under ARC. Indeed, the *same* NSTimer can be used from different places, which should presumably agree on how strongly the timer holds its target.
>
> Also, there are quite a lot of existing ARC applications that would potentially break if we changed the semantics of NSTimer under ARC, so even if we could implement this, it is really far too late.
Not impossible at all. All you have to do is add a new API, as for instance NSMapTable did in 10.8. Old code that continues to use the old API continues to get the existing behavior.
Charles
_______________________________________________
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