-
-
Notifications
You must be signed in to change notification settings - Fork 868
Description
Context
I have observed a potentially unintended behavior in the slice package.
The procedures all_of and all_of_proc currently return false when called on empty slices.
In most other programming languages and libraries, similar functions return true for empty containers.
This behavior aligns with the principle of vacuous truth in logic.
For comparison, see:
C++: std::all_of
C# / .NET: Enumerable.All
Python: all()
The current behavior may be counterintuitive and can lead to subtle bugs when developers assume that all_of behaves consistently with similar functions in other languages.
Consider updating the implementation of all_of and all_of_proc so that they return true for empty slices, in accordance with the standard behavior observed in other languages and the logical expectation.
Expected Behavior
all_of and all_of_proc return true when called on empty slices.
Current Behavior
all_of and all_of_proc return false when called on empty slices.