Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> What you could do is take a language that has arbitrary starting index value and set it to something weird. Like 42 or -5. Then rewrite your programs. See how many off by 41 errors you make. Then once you no longer make mistakes with it. Go back to 0 indexes.

Do you need me to comment on the difference between 0 and 42?



No.

But you need to see with eyes of a newbie. I mean what is the problem here, you did say it's just adding or subtracting a number whether it's 0, 1, -1 or 42? Should be trivial, right?

My guess while the change of indices is simple (altering ranges by a constant), it's going to be hard (requiring constant mental effort until it's internalized).


> I mean what is the problem here, you did say it's just adding or subtracting a number whether it's 0, 1, -1 or 42? Should be trivial, right?

Apparently I do need to comment but I don't think any human on earth has the words to convince you that, as a human, adding/subtracting by 1 is a billion times easier to understand than adding/subtracting 42.


> adding/subtracting by 1 is a billion times easier to understand than adding/subtracting 42.

Ok, then add start your indices with something else 1 or 2, -1 would be best but probably not well supported. Whatever you aren't used to.

Also why is substracting a small number such a problem? I never found adding/substracting 1, much more difficult than 42. It's just math.


> Also why is substracting a small number such a problem? I never found adding/substracting 1, much more difficult than 42. It's just math.

If the answer to your question is not self-evident, then I don't know of any words that will convince you.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: