by childintime · 1y ago · 0 comments
But I guess they wanted to iterate from the end back [-1] to the start [0], making it easy to implement a rotating buffer.
This is what was once added to C#: arr[^idx], when this ^idx is mapped to a special object, typically optimized then out. arr[^0] means the last element.
A similar approach also works for slicing the types with range operator e.g. span[start..end].