logoalt Hacker News

IshKebabyesterday at 8:20 PM5 repliesview on HN

Not to mention the 1-based indexing sin. JavaScript has a lot of WTFs but they got that right at least.


Replies

nine_kyesterday at 9:28 PM

This indeed is not Algol (or rather C) heritage, but Fortran heritage, not memory offsets but indices in mathematical formulae. This is why R and Julia also have 1-based indexing.

show 2 replies
idle_zealotyesterday at 8:33 PM

Does it count as 0-indexing when your 0 is a floating point number?

show 1 reply
bigstrat2003today at 1:40 AM

There's nothing wrong with 1-based indexing. The only reason it seems wrong to you is because you're familiar with 0-based, not because it's inherently worse.

show 2 replies
coliveirayesterday at 8:46 PM

If you can't deal with off-by-one errors, you're not a programmer.

show 1 reply
chrisweeklyyesterday at 8:38 PM

Except for Date.