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)

 [EMAIL PROTECTED]

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:
 [EMAIL PROTECTED]@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: @"@[EMAIL PROTECTED]"]

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:
  [EMAIL PROTECTED]@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/



_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to