|
From: | Tim McIntosh |
Subject: | Re: fyi - Mac OS native GDL2 / GSWeb Installer package |
Date: | Wed, 12 Mar 2008 02:07:57 -0500 |
On Mar 11, 2008, at 2:02 PM, David Ayers wrote:
Hello Tim. just a quick status report... Tim McIntosh schrieb:I think I was being too vague with regard to KVC. I wasn't referring tothe deprecated KVC methods issue that has been discussed on the listrecently, but something much more trivial. All I was talking about wasthe difference in behavior of -[NSDictionary valueForKey:] and -[NSDictionary storedValueForKey:] with respect to "special keys"(GDL2's @"allKeys" vs. Cocoa's @"@allKeys"), and the different handlingof NSArray aggregate functions when there is a key path following the aggregating operator instead of a simple key. For example: address@hidden@count With Cocoa's -[NSArray valueForKeyPath:] behavior, this would invoke [object valueForKeyPath: @"address@hidden"] on each object in the display group, then return the sum of the counts.This definitely doesn't work with WO45, but I think it is a natural extension of its concepts. So I'm inclined to attempt to support it.The funny thing is, that I think we already could do this if NSObject'svalueForKeyPath: would invoke valueForKeyPath: on the result of thevalueForKey: of the first component with the remaining key path insteadof calling valueForKey: with each component.
Seems that way to me, but it sounds like -base is just following the Apple documentation, which says: "The default implementation gets the destination object for each relationship using valueForKey: and returns the result of a valueForKey: message to the final object."
Yet this is currently just a theory and I suppose you were having issueson Cocoa's Foundation?
From the above, it sounds like Cocoa's NSObject works the same as - base, but I didn't test it.
Note: On Cocoa, I think it worked to just eliminate -valueForKeyPath: entirely from EOKeyValueCoding.m for this specific example, since Cocoa's NSArray implements a fixed set of operators, which includes the @sum and @count operators (see http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html) . However, since Cocoa does not implement the generalized/extensible behavior as found in EOF, I figured it would be better to stick with the implementation in EOKeyValueCoding if it could be made to provide a superset of what Cocoa supports.
With GDL2's behavior, this would attempt to invoke [[object valueForKey:@"itemsArray"] decimalValue] on each object in the display group, sum the results, and then invoke [result valueForKey: @"@count"] on the sum--none of which would actually work as intended in this case.Actually I'm not sure I get this far yet with -base. But it's somethingI think we could handle.
I'm not sure how far it was actually making it. I thought I was crashing on the -decimalValue message being sent to an array, but it's been too long since I actually debugged it to remember for sure.
I think this deserves a feature request bug report. Maybe you couldopen one (assign it to gdl2 and me if that's possible). Possibly attachyou patch also.
https://savannah.gnu.org/bugs/index.php?22565(Didn't see where I could assign you but I added you for e-mail notifications.)
-Tim
[Prev in Thread] | Current Thread | [Next in Thread] |