Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Counting From 1

Name: Anonymous 2020-12-27 23:14

Counting from 1 is the number one reason why I don't use Lua. Other than this, it is a very nice language, but it is just so much easier to code with half-open ranges. I disagree when people tell me "it is more natural to count from one." It is just an old leftover from the past. If you really think about it, it makes a lot more sense to count from 0.
--Zifre

Zifre, don't you mean, "Counting from 1 is the number *zero* reason why I don't use Lua."? After all, you claim that counting from zero makes so much more sense to you.
Let's make a bet. We will go to a park and talk to random people. We will show them three stones in a line, and ask them to count the stones aloud. If any person says, "Zero, one, two", then you win. If everyone says, "One, two, three", then I win. I imagine that I would always win this bet. No one counts from zero, because it makes no sense. When the first element of an array is accessed with 0, then that number represents an offset, not an index. The question is not about counting, it's about whether arrays should use offsets or indices.

Using offsets rather than indices does have some advantages, of course. But it's hard to argue with this: If arrays use indices, then the "nth" element is accessed with the number "n". Do you want the fourth element? Then use 4. Want the tenth? Then use 10. That makes a lot of sense, and has its own set of nice properties. Unfortunately, many programmers are closed-minded on this issue, and somehow convince themselves of absurd statements like, "It makes a lot more sense to count from 0." (And then, in their own post, illustrate that they in fact count from one, just like everyone else on this planet.)

Let's make a second bet. After asking people to count the stones, we will say, "Please point to stone one". If anyone points to the middle stone, then you win the bet. Otherwise, I win. Again, I don't see how I would realistically ever lose this bet. -- Anonymous

Name: Anonymous 2020-12-28 5:54

zero-element arrays is the artifact of C using arrays as syntax sugar for pointer. Arrays don't actually exist in runtime on C.

Name: Anonymous 2020-12-31 19:27

Make a circular buffer in Lua. I'll wait.

Name: Anonymous 2020-12-31 20:08

>>3

Fuck you, sadist!

Name: FORTRAN Compatibility Enforcement 2021-01-01 11:51

Remember to sign your integers.

Don't change these.
Name: Email:
Entire Thread Thread List