* John Reppy:
> FYI, I think zero-based array indexing is an artifact of the fact
> that early C did not really have arrays; it just had syntactic sugar
> for pointer arithmetic. Fortran had (has?) 1-based indices and
> Algol and Pascal had arbitrary base indices.
On the other hand, if your language supports array slices (non-copying
subarrays) and these slices preserve the original indices, you are
effectively back to zero-based indexing: you have to access relative
to the starting index of the slice, so the first element is at zero.
Ada is like that, array slice elements go from Slice (Slice'First),
Slice (Slice'First + 1) up to Slice (Slice'First + Slice'Length - 1).
This is a bit strange because Ada arrays start at index 1.
_______________________________________________
Poly/ML mailing list -- polyml@lists.polyml.org
To unsubscribe send an email to polyml-leave@lists.polyml.org