We recently turned down a request to stabilize `step_by`

on the grounds that the behavior on negative steps needs more discussion and thought. I want to kick that off

The current behavior was inherited from various free functions, prior to the range notation. The typical usage is: `(100..0).step_by(-1)`

, which is inclusive on the left an exclusive on the right – i.e., you get 100, 99, 98, … 1, but not 0. This is of course distinct from reversing the iterator `(0..100).step_by(1)`

.

I’m genuinely unsure what the best option is here. To me, the range `(100..0)`

is already quite confusing; if you read it in mathematical style, it’s an empty range.

A possible alternative would be for `range.step_by(-x)`

to be equivalent to `range.step_by(x).rev()`

, but I suspect that may also be counterintuitive to some.

So I’m interested to hear people’s intuitions, to hear about common usage patterns, and talk about how other languages/libraries do things. It’d be good to nail this down so that we can stabilize the method.