• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Could somebody please fix NSTimer?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Could somebody please fix NSTimer?


  • Subject: Re: Could somebody please fix NSTimer?
  • From: Charles Srstka <email@hidden>
  • Date: Mon, 14 Jan 2013 17:45:57 -0600

On Jan 14, 2013, at 2:38 PM, Kyle Sluder <email@hidden> wrote:

> Given that Gordon's explicit use case involves one part of his app
> setting up timers that point at objects in other parts of his app that
> know nothing of the timers' existence, this sounds like a fragility
> nightmare.
>
> The NSTimer ship has sailed.

I don't really see it. All you'd need would be a special initializer or convenience constructor, like +[NSMapTable strongToWeakObjectsMapTable]. Make versions of the +timerWithTimeInterval:etc:etc: classes which would cause the created NSTimer to weakly retain its target, and it'd just work. Adding something blocks-based instead of the target/selector stuff would of course be great too.

Of course, Quincey makes a great point that with GCD timers, we don't really need NSTimer anymore, and that it might simply be deemed to have outlived its purpose. Then again, this —

On Jan 14, 2013, at 3:25 PM, Quincey Morris <email@hidden> wrote:

> Of course, it may just be a signal that Apple hasn't gotten to blocks-enhancing NSTimer yet

is probably just as likely a possibility, given the other areas in Cocoa where blocks seem like the most natural solution in the world, but where Apple still sticks to target/selector only for whatever reason (NSApplication's sheet support, I'm looking at you).

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


  • Follow-Ups:
    • Re: Could somebody please fix NSTimer?
      • From: William Sumner <email@hidden>
    • Re: Could somebody please fix NSTimer?
      • From: Charles Srstka <email@hidden>
References: 
 >Could somebody please fix NSTimer? (From: Gordon Apple <email@hidden>)
 >Re: Could somebody please fix NSTimer? (From: David Duncan <email@hidden>)
 >Re: Could somebody please fix NSTimer? (From: John McCall <email@hidden>)
 >Re: Could somebody please fix NSTimer? (From: Charles Srstka <email@hidden>)
 >Re: Could somebody please fix NSTimer? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Could somebody please fix NSTimer?
  • Next by Date: Re: Could somebody please fix NSTimer?
  • Previous by thread: Re: Could somebody please fix NSTimer?
  • Next by thread: Re: Could somebody please fix NSTimer?
  • Index(es):
    • Date
    • Thread