4 ms·
Exactly my question. >If you try to enforce that start <= end, you lose the ability to make a Range of non-comparable things What even is a "range of non-comp
by theon144 6y ago
Exactly my question.
>If you try to enforce that start <= end, you lose the ability to make a Range of non-comparable things
What even is a "range of non-comparable things"? Doesn't the very definition, included in the article, imply an ordering because of the "upper" and "lower" bounds? What on earth is a situation where "upper" is not necessarily greater than "lower"?
- dathinab 6y agoIf you try to enforce start <= end you get a fallible range constructor which is a usability nightmare, which is why it's not enforced. It has nothing to do with `Range` being generic. I mean consider: `slice.get(start..end)` against: `(start..end).and_then(|range| slice.get(range))`