What's the big deal? 0 vs 1 based indexing

One interesting kernel, sometimes lost in the flamewars, is that the choice comes down to a preference for counting (1-based) versus offsets (0-based). Mathematically-focused languages understandably care most about counting, so the natural choice is 1-based (Fortran, Matlab, etc.). System languages dealing directly with memory tend to care most about offsets, so have usually been 0-based. Obviously there are counter-examples, but that’s the best explanation I’ve heard.

Also worth pointing out that many people have been working hard on abstractions for Julia that allow considerable flexibility in this area, see: Generalizing AbstractArrays: opportunities and challenges

38 Likes