URL:
<http://savannah.gnu.org/bugs/?47619>
Summary: NSPredicate: aggregate function expressions
implemented incorrectly
Project: GNUstep
Submitted by: thebeing
Submitted on: Mo 04 Apr 2016 15:04:40 GMT
Category: Base/Foundation
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
The aggregate function expressions (sum, min, max, avg) in base are
implemented as vararg functions. This is incorrect with respect to the Cocoa
implementation. There they are implemented as single argument functions that
take collections as arguments.
In particular, the following evaluates truthy:
NSArray *a = @[ @{ @"count": @1 }, @{ @"count": @1 } ];
NSPredicate *p = [NSPredicate predicateWithFormat: @"sum(count) == 2"];
[p evaluateWithObject: a];
(sorry, literal notation for compactness). On GNUstep it raises an
NSInvalidArgumentException (because the array of NSNumbers does not implement
-doubleValue).
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47619>
_______________________________________________
Nachricht gesendet von/durch Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-gnustep