Re: Core Data: first NSKeyValueObservingOptionOld is Null
Re: Core Data: first NSKeyValueObservingOptionOld is Null
- Subject: Re: Core Data: first NSKeyValueObservingOptionOld is Null
- From: "Timothy J. Wood" <email@hidden>
- Date: Wed, 4 Jul 2007 00:30:50 -0700
On Jul 3, 2007, at 9:48 PM, Ben Trumbull wrote:
At least Schroeder's Cat was either alive or dead, not possibly
some sticky note "what cat?"
Exactly my point; my opinion is that you still shouldn't publish
nil since it is a valid state.
If KVO requires you to publish a change, it should accurately
describe the state change. The
state change is *not* going to/from nil, it is going to/from
"unknown". These are totally
different; nil is a known and valid value that could appear in the
real world while "unknown"
isn't.
Instead, it would have been cleaner (for some values...) to have a
shared value to send as
the old/new value. When transitioning out of the unknown or into it,
you could have shared
global that could distinguish between these cases:
if ([change valueForKey:NSKeyValueChangeOldKey] == NSUnknown) {
// what are you talking about, that's not my problem
return;
} else {
...
}
This would have the pleasant side effect, that the observer could
note the transition
of "unknown" -> nil and vice versa, which is presumably impossible now.
Anyway, this isn't the end of the world, but it does make CoreData
more fragile.
File another bug.
Done; 5312201. Thanks!
-tim
_______________________________________________
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