Re: Why do I receive KVO notification when new value IS the old value?
Re: Why do I receive KVO notification when new value IS the old value?
- Subject: Re: Why do I receive KVO notification when new value IS the old value?
- From: BJ Homer <email@hidden>
- Date: Wed, 8 Jul 2009 16:36:50 -0600
Likewise, what if I had a program that was counting the number of X events
per 10 seconds, and I wanted to add a data point to a list every time it was
updated? I would definitely want to record the same number twice in a row.
It may not be a common case, but reporting the value enables situations that
filtering it out would not allow. Besides, it's not a waste of CPU cycles;
if the framework did the equality check for you first, it would be performed
on *every* notification. This way, you can only perform it on the
notifications where you need it.
-BJ
On Wed, Jul 8, 2009 at 4:17 PM, Greg Guerin <email@hidden> wrote:
> Jerry Krinock wrote:
>
> This happens not only when the new and old values are -isEqual:, but when
>> they are identically the same pointer. I can't think of any reason why
>> anyone would want notification of a no-op.
>>
>
>
> What if the operation isn't a no-op? What if the operation represented
> some kind of accumulation instead of replacement, or an incremental change
> instead of assignment?
>
> -- GG
>
>
> _______________________________________________
>
> 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
>
_______________________________________________
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