Closed
Description
cmp::partial_min(a, b)
returns a if a <= b, while cmp::min(a, b)
return a if a < b.
Same story with partial_/max
.
This will cause unexpected behaviour when a < b == a > b == false
, but a != b
(ie: ord treats them as equal, but they aren't equal). For simple types this isn't an issue because if ord treats them as equal they are usually equal. However, for more complex types, partial_min(a, b) != min(a, b)
etc. which will cause subtle errors and a lot of pain tracking down the cause.
The behaviour of the partial_
variants in this case seems more correct to me. When the two arguments are equal, it is more intuitive to return the first.
Not sure if this needs an RFC to go through.
Metadata
Metadata
Assignees
Labels
No labels