The piece to me that most says it shouldn't is analogy with indexing.
x[10..=0]
(And especially things like off-by-one things like x[1..0]
) not returning something is important, and it can't return the slice in the opposite order (since it needs to be the same type as x[0..1]
).
So if x[1..0]
doesn't return anything, I think 1..0
should also be empty.
I really like the approach of using newtypes to opt-in to reverse, where appropriate. Here's a sketch of doing that even for slices: rev_slice - Rust
(And there are perf costs to checking ranges for working in both directions that I think would be unacceptable in Rust -- I'd much rather people make their own CanGoBothWaysRange
than FasterRange
, like how String
is the basic thing so other things can be built atop it cleanly.)