• 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: removeObserver:forKeyPath: when already removed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: removeObserver:forKeyPath: when already removed


  • Subject: Re: removeObserver:forKeyPath: when already removed
  • From: Jerry Krinock <email@hidden>
  • Date: Wed, 11 Nov 2009 16:36:02 -0800


On 2009 Nov 11, at 15:36, Jim Correia wrote:

Cocoa reserves the use of exceptions for programming errors an unexpected runtime errors.

:))

Trying to remove an observer for a key path which has already been removed (or never registered) falls into the programming error class...

Almost always true. But what if, and yes I know this is pretty flakey but just assume it could happen, that I needed to do some very expensive operation to determine whether or not an observation had been removed. Then, it would be efficient and smart to send the removeObserver:: message unconditionally.


But how is the programmer to know this is an error if it's not documented as a "don't do"? If indeed this is not documented, then in my opinion it's a documentation error.

_______________________________________________

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: removeObserver:forKeyPath: when already removed
      • From: Jim Correia <email@hidden>
References: 
 >removeObserver:forKeyPath: when already removed (From: James Walker <email@hidden>)
 >Re: removeObserver:forKeyPath: when already removed (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: iPhone CLLocation Accuracy?
  • Next by Date: Re: Garbage collection and about windows
  • Previous by thread: Re: removeObserver:forKeyPath: when already removed
  • Next by thread: Re: removeObserver:forKeyPath: when already removed
  • Index(es):
    • Date
    • Thread