|
Version: Pharo 6.1
Minimal reproduction: #() sum.
Expected: 0 Actual: SubscriptOutOfBounds.
The error is in the #sum method on the Array class. It chooses a sample by calling #anyOne, but as the array is empty this results in an error.
The reason I believe this should be fixed is that calling #sum on an empty array is a valid use case, particularly when using a method like #select.
E.g. (myCollection select: [:i | i meetsSomeCriteria ]) sum , where none of the values in myCollection meet the criteria.
|
|
|
Priority: 5 – Fix If Time
|
|
Status: Work Needed
|
|
Assigned to: Everyone
|
|
Milestone: Later
|
Go to Case
|
|