string a = "hello";
string b = a[3 .. 2];
I expect b to become an empty slice, because 3 is >= 2 already
after 0 increments, making the slice length 0. Instead, the code
throws a range violation.
Expressions of this kind come up, e.g., when taking slices near
the end of arrays, like "slice = a[b.length .. $];". To make this
robust, I need an extra check for b.length > a.length, returning
null in this case, otherwise a[b.length .. $].
What's the design reason to prefer throwing over returning an
empty slice?
-- Simon