5 ms·
Yeah why on earth did they do this? It's such a pain. I can't think of a reason why it would be a good idea, except perhaps "non-programmers don't expect to cou
by jlarcombe 8y ago
Yeah why on earth did they do this? It's such a pain. I can't think of a reason why it would be a good idea, except perhaps "non-programmers don't expect to count from zero" but surely it's easier to overcome that than overcome all the little problems that stem from starting indices from 1.
- ModernMech 8y ago> but surely it's easier to overcome that than overcome all the little problems that stem from starting indices from 1. It's not. You're asking new learners to overcome a great deal of intuition when already attempting to learn a mind-bending thing like programming. I've taught C++ and Matlab side by side to freshmen in university. They learn C++ first and encounter all kinds of off-by-one errors the compiler doesn't help them catch. When they get to Matlab, the universal sentiment I've found is "wow, this makes so much more sense" For new learners, 0 indexing seems like such a pointless frustration with an obvious solution. It can be a needless roadblock for people otherwise excited to learn.
- blt 8y agoAn underappreciated facet of matlab that makes it mistake-resistant: by default, all parameters are passed by value. Thus, all functions are pure / referentially transparent at their interface, even if mutation is used internally. This combination is the easiest for beginners to learn, IMO.
- ufo 8y agoWhen Lua was originally created its primary audience were engineers used to FORTRAN's 1-based indexing.