Re: KVO and the observeValueForKeyPath bottleneck
Re: KVO and the observeValueForKeyPath bottleneck
- Subject: Re: KVO and the observeValueForKeyPath bottleneck
- From: Jim Correia <email@hidden>
- Date: Tue, 18 Jul 2006 12:11:27 -0400
On Jul 17, 2006, at 9:00 PM, Chris Kane wrote:
If you assume that @"" string constants are NOT globally uniqued in
a binary, but only to a given compilation unit, then
ThisClassUniqueObservationContext could be a constant string:
static NSString * ThisClassUniqueObservationContext = @"MyContext";
Even if the strings are globally uniqued across the entire binary,
assuming a FBFroobazle class, something like this is probably good
enough:
static NSString * FBFroobazzleValueObservationContext =
@"FBFroobazzleValueObservationContext";
Certainly better than
static void * FBFroobazzleValueObservationContext = (void *)2192;
There is the chance that someone else will use the string
@"FBFroobazzleValueObservationContext" as an observation context
elsewhere in the inheritance tree, but I think that a) it would be a
programmer error b) is probably not worth losing any sleep over.
And there is certainly a smaller chance of a collision than with an
arbitrarily picked number.
Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden