Hacker News new | ask | show | jobs
by ethbr0 1388 days ago
It's fundamentally a distinction between end-index and start-index.

Most human counting uses end-index. I.e. "1" is after 1-thing (has passed, is physically obtained, etc.).

Most computer counting uses start-index + length, for efficiency and to better generalize. I.e. "1" is at the memory address immediately before the "1"st item.

Which ultimately creates the "0 index is 1st thing" linguistic confusion.

PS: Also, language predates computers by a few years, and the concept of zero is hard.

1 comments

good take!

i think a more accurate and complete idea is that humans refer to a thing in its entirety, with things being lined up and scanned in order as only a potential convenience

if you ask someone to identify an object, they'll point to the middle (or center of the most important component) of the object, not to the 'start' or 'end' of it in their field of vision..

that said, the human perspective is subtle and convenient in completely different ways to how a computer manages memory, and this 'end-index' idea seems like a useful way to map the human whole-object perspective to a linear memory-index perspective

They may point to the middle, but that's not a reference to half an object. ;)

The assumption is that the thing is its entirety, as you said.

Hypothetically, I imagine an array index reference, in human terms, would be communicated as "this thing starts here" or "this is the beginning of this thing."

Which isn't a concept or phrasing we have much occasion to use, other than for routes or long length-measured objects?