Hacker News new | ask | show | jobs
by jcparkyn 1134 days ago
Spoken like someone who's never used Matlab :)
1 comments

> indexes start at 1

- no one

-- Matlab

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.

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