You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but don't have the normal mathematical meaning; instead, they mean [A, A+N) (where the "+" means "the value that would be obtained by N applications of ++ to A" rather than operator+).
We should not abuse established mathematical notation in this way, and should find a different and unambiguous way to present counted ranges.
FWIW, +1 from me as the originator of this particular abuse of interval notation. It was originally less offensive since we used it in contexts where it was plain that the second member of the tuple is not a sentinel a la [i, 42), but we've had to avoid using it in less clear contexts ([i, n) isn't horrible, but [i, j) surely is). This context-sensitivity is a clear indicator that overloading the syntax is a bad idea.
I agree that we should not overload existing, established notation for counted ranges.
I don't have an "obvious" solution, but maybe we can define a slightly more elaborate device, maybe like “p + [0, N)” or so, to denote the set of iterators p + 0, p + 1, ..., p + (N - 1)? Something like a pair of a starting iterator plus the set of all valid offsets?
Activity
CaseyCarter commentedon Jun 14, 2019
FWIW, +1 from me as the originator of this particular abuse of interval notation. It was originally less offensive since we used it in contexts where it was plain that the second member of the tuple is not a sentinel a la
[i, 42), but we've had to avoid using it in less clear contexts ([i, n)isn't horrible, but[i, j)surely is). This context-sensitivity is a clear indicator that overloading the syntax is a bad idea.[-]counted ranges abuse mathematical notation[/-][+]Counted ranges abuse mathematical notation[/+]tkoeppe commentedon Jun 15, 2019
I agree that we should not overload existing, established notation for counted ranges.
I don't have an "obvious" solution, but maybe we can define a slightly more elaborate device, maybe like “
p + [0, N)” or so, to denote the set of iteratorsp + 0,p + 1, ...,p + (N - 1)? Something like a pair of a starting iterator plus the set of all valid offsets?jensmaurer commentedon Nov 4, 2019
Editorial meeting: Define range of iterators. "Elements in the range" means dereferencing the iterators in the range. Use "
p+ [0,N)".