gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recent key-value encoding changes to NSObject.


From: Richard Frith-Macdonald
Subject: Re: Recent key-value encoding changes to NSObject.
Date: Mon, 11 Feb 2002 15:02:58 +0000

On Monday, February 11, 2002, at 02:38 PM, Nicola Pero wrote:

NSObject -handleQueryWithUnboundKey: raises an exception. It is meant to
be overridden in subclasses.  If in a subclass you want to do something
else (than raising an exception), you override -handleQueryWithUnboundKey:
to do whatever you want, then if what you want to do fails, you call
[super handleQueryWithUnboundKey:].

I'm assuming that there is some reason for not wanting to do this ... perhaps
the need to change the steps that are gone through to obtain a value -
eg. you have a dictionary ivar 'values', and you want to return values from that dictionary - but the names of keys in that dictionary might clash with
names of your ivars such that the standard mechanism would return the
wrong result (the ivar rather than the value from the dictionary).
You could get round that by providing explicit get/set methods for each
ivar, but that wouldn't cope with the case where someone subclasses your
class, adds ivars, and doesn;t know that they need to add more get/set methods.

I think I've shown in a previous email that overriding the KVC methods
and/or overriding other standard methods can handle these sorts of cases
where the obvious mechanism isn't quite right for some reason.

I don't know exactly what you're trying to do, so I/we might be missing
something, in which case let us know exactly what the problem is.

That's how I feel too... can't see the point of the additions and am
wondering if I've missed something.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]