17130, “vasslitvinov”, “Range.low, high - should be aligned?”, “2021-02-09T07:55:30Z”
Stridable ranges have the “alignment” property, because of which the “low bound” may differ from the “aligned low” bound, which is the first or the last index in the corresponding sequence.
Traditionally, range.low
and range.high
were not necessarily aligned. This works fine in most cases until the user hits a case where alignment matters and has to spend time investigating an issue.
We propose to re-purpose range.low
and range.high
to return the aligned bounds, which are less error-prone, and provide separate methods to return raw bounds.
Pros: reduce user surprises and debugging time.
Con 1: it is challenging to transition from the current meaning of the low/high methods.
One possible direction: deprecate range.low/range.high for a release or two, then reinstate with the new meaning.
Another possibility: go ahead and assign them the new meanings. Although this would break user functions that do something similar to the built-in range.exterior()
.
Con 2: it is unintuitive for the user to create a range with the low bound X and have low
return something other than X.