Hacker News new | ask | show | jobs
by MiyamotoAkira 1134 days ago
Pascal had indexes starting at 1 too.

Starting indexes at 0 makes sense when you want to enable the developer to manipulate memory (for example, C)

Indexes starting at 1 matches with a more natural ordinal sequencing.

3 comments

The most evil was Visual Basic where you could configure the default starting index (OPTION BASE 1), leading to weird bugs when multiple people worked on the same codebase.
I don’t understand. Either your saying adding or removing elements to an array doesn’t manipulate memory, or you’re saying adding or removing elements in an array does manipulate memory, but the developer doesn’t care due to the GC.

If it’s the second option, why has (almost) every other language chosen with a GC to start arrays with 0?

> indexes starting at...

"I don't understand the word 'index'".

- a functional programmer