On Aug 15, 2008, at 10:23, Adam R. Maxwell wrote:

Sending empty willChange/didChange messages is not a good idea:

http://www.cocoabuilder.com/archive/message/cocoa/2008/5/18/207038

Except that the idea of "non-empty" willChange/didChange messages doesn't cohere. The following is a perfectly legal setter:

- (void) setX: (NSInteger) newX {
        [self willChangeValueForKey:@"x"];
        iVarX = newX;
        [self didChangeValueForKey:@"x"];
}

When this is called with newX == iVarX, it doesn't do anything except call willChange/didChange, so it's "empty" in that case, if "empty" had any meaning here. If there was some problem with "empty" setters, that scenario would fail. Does setting a property to its current value fail?

It may well be different for Core Data property setters, though.

IAC, Marcus's alternative is to do this:

        object.temperature = object.temperature;

instead of this:

        [object willChangeValueForKey:@"temperature"];
        [object didChangeValueForKey:@"temperature"];

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to