|
From: | David Ayers |
Subject: | [bug #22565] EOKeyValueCoding: Support modern Cocoa KVC semantics for NSArray aggregate functions |
Date: | Thu, 13 Mar 2008 20:35:39 +0000 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.1.12) Gecko/20080129 Iceweasel/2.0.0.12 (Debian-2.0.0.12-1) |
Follow-up Comment #3, bug #22565 (project gnustep): Lets have closer look at some key paths... (I'm not using @count because it's special since the parameter is optional) displayGroup.allObjects.@sum.value Currently implementation starts evaluating from left to right: #define vfk valueForKey t = [displayGroup vfk: @"allObjects"] t = [t vfk: @"@sum.value"] Now NSArray's implementation would invoke computeSumForKey:@"value" on itself. That implementation iterates over the receivers objects and asks each item: sum += [[currentItem valueForKey:@"value"] decimalValue] and return the sum. Fine... Now let's look at: displayGroup.allObjects.@sum.detailArray.@avg.value The current proposed implementation would send: t = [displayGroup vfk: @"allObjects"] t = [t vfk: @"@sum.detailArray"] for each item in the array sum += [[currentItem vfk:@"detailArray"] decimalValue] this is broken... we do not want to send detailArray's decimalValue. What we actually want is to send: t = [displayGroup vfk: @"allObjects"] t = [t vfk: @"@sum.detailArray.@avg.value"] And then possibly have NSArray's implementation send something like: for each item in detailArray [item vfk:@"avg.value"] collect an interim array of {@"value"=<numbers>} then invoke [interimArray vfk:@"sum.value"] and return that result. Given a key path like: displayGroup.allObjects.@sum.detailArray.@avg.value.stringValue.length We would still want to merely group the aggregate keys I believe... So I guess wrt NSArray's implementation I guess the part I quoted is OK, but the calculation of the range is wrong. We want to group the aggregate key paths. And then we need to look into NSArray's valueForKey: implementation to be able to handle arbitrary aggregate key paths... _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?22565> _______________________________________________ Nachricht geschickt von/durch Savannah http://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |