4 ms·
I was hoping for an interesting analysis of 0 vs 1 based indexing, but instead got a 3 page rant of HN-this and appeal-to-authority-that which adds absolutely n
by kstenerud 6y ago
I was hoping for an interesting analysis of 0 vs 1 based indexing, but instead got a 3 page rant of HN-this and appeal-to-authority-that which adds absolutely nothing of value to the discussion. It feels more like a bottom-of-the-page angry comment to an article than an actual article.
- codefreakxff 6y agoFully agree. Got to the end of the post and was looking for the rest. The ranting could have been fine if there was more information and exploration. As it is, it’s unremarkable and not worth reading
- NotAnOtter 6y agoThis is probably because this whole debate is pedantic and irrelevant. 0-base wins, at this point it's not about picking a fork in the road, just swimming up stream for the sake of standing out. LUA is over 23 years old at this point, it made a arbitrary design decision and has had to die on that hill ever since.
- anonymoushn 6y agoIt looks like LUA is only 7 years old: https://github.com/mniip/LUA https://github.com/mniip/LUA
- omnicognate 6y agoThat copyright comment doesn't say Lua is 7 years old and I don't see how you could interpret it as such. Lua is generally considered to have been created in 1993: https://en.m.wikipedia.org/wiki/Lua_(programming_language) https://en.m.wikipedia.org/wiki/Lua_(programming_language)
- catwell 6y agoYou didn't get the joke. Hint: case matters (and look at that repo :p).
- omnicognate 6y agoAh, gotcha
- user-the-name 6y agoYeah, this is a bunch of paragraphs complaining that arguments for 0-based aren't good enough for him, but giving no actual arguments FOR 1-based. That's not how you convince anyone. You can't just say that the other guy is wrong without giving any explanation for why you are right. Plus, the last bit is just "imagining a guy and getting angry at that guy", the absolutely dumbest form of argumentation.
- bregma 6y ago> You can't just say that the other guy is wrong without giving any explanation for why you are right. Finally, someone who has never followed electoral politics or current affairs.
- user-the-name 6y agoNot sure what you are trying to say here. It is a well known principle in political campaigning that presenting positive policies tends to gain you more votes than negative attacks on the policies of your opponents.
- cbolton 6y agoI quite disagree, I think it makes two insightful points: 1. In this discussion, people often overlook that these numbers are applied to two different concepts: offsets and numbering. 2. If C had been designed with 0-based pointers (for offset calculation) and 1-based indices (for numbering the array elements) people would probably find this a strength, to have the most appropriate base for each case. It's an interesting what-if idea that I hadn't seen before.
- marcosdumay 6y agoIf C had 0-based pointers and 1-based indices, every CPU in existence would have a "subtract 1, multiply, and add" instead of an "multiply and add" instruction and everybody would think this is stupid because "multiply and add" could be used for a lot of things, but "subtract 1, multiply, and add" has only one use.
- cbolton 6y agoCPU instructions like load and move can apply an offset that is encoded as part of the instruction. This is more flexible than a special instruction for "offset=1", and useful beyond 1-based indexing. See for example https://www.cs.virginia.edu/~evans/cs216/guides/x86.html https://www.cs.virginia.edu/~evans/cs216/guides/x86.html and https://www.keil.com/support/man/docs/armasm/armasm_dom1361289873425.htm https://www.keil.com/support/man/docs/armasm/armasm_dom13612... . I'm not sure about "multiply and add"... Aren't these instructions for computing with floating point numbers rather than offsets?
- city41 6y agoCouldn't one based indexing be sugar the compiler provides? I don't think having pointers and indices behave differently is a good idea for the record.
- mxcrossb 6y agoIt was super frustrating to see the author dismiss Dykstra’s argument as an appeal to authority. No it isn’t, it just means that we find the arguments he outlined compelling. As someone who switches between C and FORTRAN daily, it’s incredibly clear that zero based indexing is easier.
- pantsforbirds 6y agoMy opinion is that languages where you work with vector representations primarily (or at least often) like Fortran, Matlab, Julia are best with a 1 index. They are languages primarily used for math and simulations and are pretty specialized so the indexing and representation of the vectors matches closer to how you would consider things if you were doing linear algebra by hand. Julia, Matlab, and Fortran are also all column major for multi dimensional arrays too. For numeric work ill take 1 index any day of the week, but for general programming or other CS work (like non vector/matrix data structures) i much prefer 0 indexing.