a <= x < b
over the other three forms in the general case. But he fails to make an argument for the special case of 0-based indexing vs 1-based.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:
1 <= x < n+1
is more awkward than 0 <= x < n
But he doesn't even present the alternative: 1 <= x <= n
is less awkward than: 0 <= x <= n-1
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.