News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language (2021) by jcelerier on Thursday September 29, 2022 @05:12PM (#33027278)
> While I agree about the points you made, you cant take the zeroth element out of your shopping bag, you take the first one.

where does the first centimeter / inch start in a physical ruler ?

Re:Lua, a Misunderstood Language (2021) by thunky on Thursday September 29, 2022 @07:21PM (#33028705)
You're both right.

You want to measure the distance from a starting point (zero), the person you're replying to wants to count/label things from a starting point (one).

The distance method doesn't work as well for picking items from a bag, and the counting method doesn't work as well for calculating offsets.

They can both work for arrays, so neither is wrong.

Re:Lua, a Misunderstood Language (2021) by topaz0 on Friday September 30, 2022 @10:38AM (#33035503)
I'm mad at myself for getting dragged into this, but. Leaving aside the fact that array indexes are not continuous in the way ruler measurements are, what does it say that you just called it the 1st inch, not the 0th?
Re:Lua, a Misunderstood Language (2021) by jcelerier on Friday September 30, 2022 @11:23AM (#33036104)
> Leaving aside the fact that array indexes are not continuous in the way ruler measurements are,

I have always seen a ruler as a discrete sequence of centimeters even if the physical object is continuous

> what does it say that you just called it the 1st inch, not the 0th?

but it's literally what I'm saying aha. The index of the first element is zero, even on basic household objects.

Re:Lua, a Misunderstood Language (2021) by topaz0 on Friday September 30, 2022 @11:57AM (#33036603)
> I have always seen a ruler as a discrete sequence of centimeters even if the physical object is continuous

I have trouble believing this. Does this mean you think of a ruler as a tool to assign lengths (continuous) to discrete intervals, rather than as a tool to (perhaps imprecisely) measure the (continuous) length.

Re:Lua, a Misunderstood Language (2021) by jcelerier on Friday September 30, 2022 @12:06PM (#33036721)
for me a ruler is something that tells me how many centimeters there is in whatever it is I want to measure - but maybe it's for linguistic reasons? e.g. in french I'd say "y'a combien de centimètres là?" when measuring something long with a tape meter and someone's help, which translates to "how many centimeters are there right now?" more or less