2. How is (c) better for calculating range size if you're using 1-based?
3. "But how do you have two adjacent ranges when they both have the same starting position?" What do you mean?
Consider the length n prefix of a sequence. With 1-indexing, for n = 0, we have sequence[1:0], which means
a. The end position is before the start position (?!).
b. We have to use 0 anyway.
In (c) with 1-based ranges the size of the range is present in the range. There is no calculating because the value is there. 1 <= x <= size
One argument for the notation (not 0 vs 1 based ranges) is that notation (a) offers easier detection of adjacent ranges. This is irrelevant to the 0 and 1 based range debate.
When restricted to just the discussion of 1-based and 0-based:
1. The experience report doesn't seem to apply as it's about the general notation advantage, not the specific cases of 0- or 1-based indexes. We would need additional experience reports about those (which I suspect would tend to favor 0-based).
2. We don't need to worry about calculating the range size, because it's obvious for both cases. Yes, (a) is better if you're using 0-based indexes and it's awkward if you're using 1-based. But (c) is better if you're using 1-based and awkward if you're using 0-based. (a) leaves the range size of a 0-based index in the range description, and (c) leaves the range size of a 1-based index in the range description. The argument becomes a wash, neither is obviously better than the other on this basis.
3. The argument that (a) is better because you can see if two ranges is a persuasive one. But how do you have two adjacent ranges when they both have the same starting position? It's irrelevant to the case for either 0-based or 1-based arrays.
His final argument is that:
is more awkward than But he doesn't even present the alternative: is less awkward than: Again, a non-argument because it assumes the outcome he wants, that 0-based is fundamentally better.Now, all that said 0-based has other advantages. But Dijkstra fails to address those other advantages. Ultimately, though, as I said in the other discussion, your language shouldn't restrict your range description options to either.
> You really should accept his argument though. It's quite persuasive.
I don't think anyone should accept the argument because it is not persuasive. There are much better arguments for 0-based indexing than this EWD. We should scrap flawed arguments when we have much better ones available. The best part of the EWD is the description of which range notation is "better", but not the part about 0-based indexing.