[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: KVC
From: |
Helge Hess |
Subject: |
Re: KVC |
Date: |
Wed, 6 Jun 2007 21:45:05 +0200 |
On Jun 6, 2007, at 20:55, Chris Farber wrote:
The other thread about KVC and unicode reminded me of this email.
Are you talking about the behavior of valueForKeyPath: here?
Not sure what you mean. Is there anything missing in the quoted
email? Its not related to pathes.
I just noticed a minor difference between Cocoa and gnustep-base
KVC. Both support the new
-setValue:forKey:
method.
However, on Cocoa -takeValue:forKey: still seems to be called if
the method isn't implemented (I suppose to ensure compatibility).
On GNUstep it just fails (the unknown key exception).
Maybe if I re-explain it. In MacOS 10.4 (or 10.3?, don't remember)
Apple changed the KVC API. The selector:
takeValue:forKey:
got renamed to
setValue:forKey:
( what a great idea ... ;-/ )
Since a lot of code (including OGo ;-) was written before MacOS
10.3/4, the code does not override setValue:forKey: but
takeValue:forKey: if it wants to modify the default KVC behaviour of
an object.
Now GNUstep only seems to support the new API (setValue:forKey:) for
code which changes the KVC behaviour. That is, our custom
takeValue:forKey: implementations are not called anymore.
On Cocoa it seems to be different. If your class overrides -
takeValue:forKey:, but not -setValue:forKey:, KVC will still call
your overridden -takeValue:forKey: method.
Maybe I'm wrong. As Richard suggested it would be best to come up
with a series of tests for the KVC behaviour in various setups.
Thanks,
Helge
--
Helge Hess
http://www.helgehess.eu/
- Re: KVC, Chris Farber, 2007/06/05
- Re: KVC, Richard Frith-Macdonald, 2007/06/06
- Re: KVC, Helge Hess, 2007/06/06
- Re: KVC, Chris Farber, 2007/06/06
- Message not available