(no title)
throwaway17_17 | 27 days ago
1) using 0 as the index of the first element in a list-like object ISA holdover from C (most of the earlier languages used either 1 based or flexible base for indexing);
2) in C, 0 is the index due to the manner of C’s array indexing implementation;
3) if holding onto the C semantics (or syntax in some respects) is not an explicit goal of the language, then flexible indexing should be the default (declared at creation point for the list-like object);
4) in flexible default is not appealing to the language designer, and again, maintaining C semantics is not a goal, then 1 based should be the next reasonable default.
For me, when counting things (and most other native English speakers, if not most people in general), the first item counted is object 1. Therefore, 1 should be the index of the beginning of the list-like objects indexing.
I’m not sure how about 0 being ‘None’, but I might find it intuitive if thinking more about it.
teo_zero|26 days ago