Re: self and _cmd
Re: self and _cmd
- Subject: Re: self and _cmd
- From: Chris Kane <email@hidden>
- Date: Wed, 5 Sep 2001 14:06:35 -0700
On Wednesday, September 5, 2001, at 05:36 AM, Ondra Cada wrote:
Rob Rix (RR) wrote at Wed, 5 Sep 2001 02:17:15 -0400:
RR> Just recalling how the runtime sends implicit arguments to methods:
self
RR> and _cmd. Well, we all know how useful self is, but has anybody done
RR> anything useful/cool with _cmd?
-(void)notWorthUsingNSTimer {
...
[self performSelector:_cmd withObject:nil afterDelay:delay];
}
Ha! the implementation will show you what's not worthwhile. :-)
-performSelector:withObject:afterDelay: simply creates an NSTimer and
schedules it. Or CFRunLoopTimer, I forget which nowdays, but it's the
same thing.
The odd thing about this example is that you're scheduling
"notWorthUsingNSTimer" to execute later, which is probably not what you
want, since it'll apparently result in an infinite, if slowly, and
"out-of-bandedly", executed, loop. :-)
Chris Kane
Cocoa Frameworks, Apple