News for hackers. Stuff that matters.
Re:Indices Point Between Elements by Retra on Monday August 24, 2015 @02:49PM (#10112163)
Specifically, this:

>"Indexing between elements, instead of indexing elements, helps avoid a large class of off-by-one errors."

It only replaces them with indexing-method errors. Instead of remembering if my ranges are open or closed, I have to remember if they are using between-element indices or on-element indices. It's still going to cause the same kinds of problems.

Re:Indices Point Between Elements by rcthompson on Monday August 24, 2015 @02:55PM (#10112217)
You always have to remember what kind of indexing you are using in order to avoid making errors. But using this mental model will help people avoid making off-by-one errors because they don't even understand the indexing in the first place.