StrideTo/Through public properties

I have some additional ideas for making it easier to use stride types, and I’m wondering if people would prefer one combined proposal or two separate smaller ones.

Building on the ideas from the thread Slicing syntax for math in Swift (tensors), I would like to see a syntax along these lines for striding:

for i in 1..<10.by(3) {
  print(i)  // 1, 3, 7
}

for i in 10...0.by(-5) {
  print(i)  // 10, 5, 0
}

This is easily achieved:

Strideable range shorthand implementation
struct StrideBound<Bound: Strideable> {
  var bound: Bound
  var stride: Bound.Stride
}

extension Strideable {
  func by(_ stride: Stride) -> StrideBound<Self> {
    return StrideBound(bound: self, stride: stride)
  }
  
  static func ... (lhs: Self, rhs: StrideBound<Self>) -> StrideThrough<Self> {
    return stride(from: lhs, through: rhs.bound, by: rhs.stride)
  }
  
  static func ..< (lhs: Self, rhs: StrideBound<Self>) -> StrideTo<Self> {
    return stride(from: lhs, to: rhs.bound, by: rhs.stride)
  }
}

It’s worth noting here that “10...0” by itself would still be invalid: the new functionality is only invoked when the rhs has .by(stride) called on it.