On Saturday, 1 August 2015 at 09:35:53 UTC, DLearner wrote:
Does the D language set in stone that the first element of an
array _has_ to be index zero?
Wouldn't starting array elements at one avoid the common
'off-by-one' logic error, it does
seem more natural to begin a count at 1.
Actually, maybe even better to allow array definitions of form
int foo[x:y];
(y >= x) creating integer variables foo[x], foo[x+1],...,foo[y].
I think the (very old) IBM PL/I language was like this.
There is a good metaphor in multi-story buildings. Americans
number the first or ground floor of a high rise as floor #1. In
the UK, their first floor is what Americans would call the 2nd
floor.
But then how can you trust a group of people who drive on the
wrong side of the road :)