News for hackers. Stuff that matters.
Re:Lua vs Ruby benchmarks (similarly "high-level" languages,... by LogicHoleFlaw on Saturday January 31, 2009 @12:28PM (#459795)
These are some of the best arguments for 0-based indexing, and I agree that these are very useful properties. In my day-to-day programming though, the 1-based indexing has some (admittedly, less math-based) advantages too. For instance when I have an array my brain appreciates the simplicity of the "oh, this array has 10 elements. What's the last element? Number 10! Yay, that was easy" thought process.

In many cases I don't care about specifying boundary conditions at all; I will just use something along the lines of

  for i, v in ipairs(t) do something_interesting(i, v) end
or even just a map or fold or some other iteration technique where I'm not explicitly specifying boundary conditions. If I'm implementing a heap or some other data structure which uses calculations to interact with an array I will be double-checking my math anyway because I don't trust myself to get it right the first time, 0-based indexing or not ;)
Re:Lua vs Ruby benchmarks (similarly "high-level" languages,... by ralph on Saturday February 07, 2009 @12:46PM (#471291)
The last element of an array is foo[-1] regardless of it's length. :-) And try implementing a circular buffer using an array of N elements with 1-based indexing and then 0-based. Sorry in advance for the loss of hair due to the former.
Re:Lua vs Ruby benchmarks (similarly "high-level" languages,... by tokipin on Saturday February 07, 2009 @07:01PM (#471606)
you mean like array[mod(i, length) + 1]