On 30.11.2007, at 08:03, David Ayers wrote:
I missed the fact that backward compatibility was turned on by default.
But I don't understand how the runtime check
static IMP o = 0;
/* Backward compatibility hack */
if (o == 0)
o = [NSObject instanceMethodForSelector:
if ([self methodForSelector: @selector(takeValue:forKey:)] != o)
[self takeValue: anObject forKey: aKey];
is supposed to work. The objects generally /rely/ on KVC, they don't
override the primitives. Generally they implement the accessor methods
(with or without underscore / 'get') or use one of the ivar conventions.
This check is especially done for the transitional case, where some special -takeValue:forKey: handling is used, but initially triggered via -setValue:forKey:. It just occured recently during an ongoing port of OGo (OpenGroupware.org) to use gnustep-base instead of libFoundation. In this special case, code inside SOPE already used -setValue:forKey:, but subclasses of WOComponent inside OGo relied on old -takeValue:forKey: behavior. I guess that such problems might arise frequently during transitional phases and hence added checks where I found them missing to KVC in gnustep-base.
I would love to see a way to gradually update the API while keeping
backward compatibility. But my personal goal is keep GDL2 compatible
with WO45 as long as I need to support legacy installations.
In my opinion it doesn't make any sense to change GDL2 to use the new KVC API, it makes sense as it is. To have an own (extended) implementation of KVC makes sense to have in GDL2, and probably is also necessary.
I would also like to see the "legacy" KVC support being available in gnustep-base for as long as possible, but that doesn't mean that you should enforce it at all cost - that's why it's probably best to add this as an autoconf option for configure later on.