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 to
the deprecated KVC methods issue that has been discussed on the list
recently, but something much more trivial. All I was talking about
was
the difference in behavior of -[NSDictionary valueForKey:] and
-[NSDictionary storedValueForKey:] with respect to "special keys"
(GDL2's @"allKeys" vs. Cocoa's @"@allKeys"), and the different
handling
of NSArray aggregate functions when there is a key path following the
aggregating operator instead of a simple key.
For example: [EMAIL PROTECTED]@count
With Cocoa's -[NSArray valueForKeyPath:] behavior, this would invoke
[object valueForKeyPath: @"[EMAIL PROTECTED]"] 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's
valueForKeyPath: would invoke valueForKeyPath: on the result of the
valueForKey: of the first component with the remaining key path
instead
of 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
issues
on 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
something
I 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 could
open one (assign it to gdl2 and me if that's possible). Possibly
attach
you 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
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev