Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Counted ranges abuse mathematical notation #2932

Closed
zygoloid opened this issue Jun 14, 2019 · 3 comments · Fixed by #3603
Closed

Counted ranges abuse mathematical notation #2932

zygoloid opened this issue Jun 14, 2019 · 3 comments · Fixed by #3603
Assignees

Comments

@zygoloid
Copy link
Member

Counted ranges are presented as

[A, N)

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.

@CaseyCarter
Copy link
Contributor

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.

@tkoeppe tkoeppe changed the title counted ranges abuse mathematical notation Counted ranges abuse mathematical notation Jun 15, 2019
@tkoeppe
Copy link
Contributor

tkoeppe commented 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 iterators p + 0, p + 1, ..., p + (N - 1)? Something like a pair of a starting iterator plus the set of all valid offsets?

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Aug 6, 2019
@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Sep 10, 2019
@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Sep 26, 2019
@jensmaurer
Copy link
Member

jensmaurer commented Nov 4, 2019

Editorial meeting: Define range of iterators. "Elements in the range" means dereferencing the iterators in the range. Use "p + [0,N)".

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Nov 4, 2019
@jensmaurer jensmaurer self-assigned this Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants