• 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: KVO and the observeValueForKeyPath bottleneck
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: KVO and the observeValueForKeyPath bottleneck (From: Matt Neuburg <email@hidden>)
 >Re: KVO and the observeValueForKeyPath bottleneck (From: Chris Kane <email@hidden>)
 >Re: KVO and the observeValueForKeyPath bottleneck (From: Jakob Olesen <email@hidden>)
 >Re: KVO and the observeValueForKeyPath bottleneck (From: Chris Kane <email@hidden>)

  • Prev by Date: Updating webview with HTML attribute of a managed object
  • Next by Date: Re: Updating webview with HTML attribute of a managed object
  • Previous by thread: Re: KVO and the observeValueForKeyPath bottleneck
  • Next by thread: Re: KVO and the observeValueForKeyPath bottleneck
  • Index(es):
    • Date
    • Thread