People can learn to deal with adding 1, but it’s still a cognitive encumbrance that loads us down and makes life harder.
Not that I’m advocating for one-based indexing. At this point consistency is more important than whatever the easier solution is.
Off by one errors in general have nothing to do with being 1 or 0-based indexed.
In French off-by-one error is called “the post and fence problem” because there's always one more post than piece of fence (unless your fence makes a loop).
It arises because it's easy to confuse the number of intervals between elements and the number of elements (which is also: do I need to include the bounds or not). 1-based indexing isn't going to help at all in the general case (it will help for the most basic error which is getting the last element of an array with `a[a.length]`, but that's it)
For example what is the index of pixel X,Y in an image buffer? X + Ystride right? Nope! It's X + (Y-1)stride.
What's the range of the Ith block of N elements? [in, in + n)? Nope! It's [(i-1)n+1, in].
I have to deal with that nonsense in Matlab all the time. Nightmare.
If machine code uses zero then assembly inherits that, them C and everything else. Even JS months!
Maybe because they didn't want to "hide the bicycle gears"?
Yes you are!! In memory, and conceptually. You're conceptually moving your finger 0 spaces from the start of the apple array.
Yeah that's because the distinction between indexing and counting is pretty much irrelevant to every day use, and to maths where you can just hand-wave syntax. So people are very used to doing it "wrong".
That's what most of the issue with this debate is. Indexing from 1 is wrong, but people are soooo used to it they just can't get over what they think is the "normal" way.
No it's not. Telling the time or measuring something is 0-indexed. But identifying a thing in a list is 1-indexed.
While I understand the CS concepts, I have never really thought about the developer UX before.
Everywhere else, indexing is just a convention, even in natural language and math.