News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language by phaedryx on Friday January 15, 2021 @05:28PM (#25797380)
There are only two hard things.

This is an aside, but I think that "index" is the wrong name. I wish that "index" meant you start counting at 1 (which everyone outside of CS does) and "offset" was the name for starting at 0.

Re:Lua, a Misunderstood Language by nvader on Friday January 15, 2021 @05:31PM (#25797399)
1ndex and 0ffset. I like it.
Re:Lua, a Misunderstood Language by d3ckard on Friday January 15, 2021 @05:48PM (#25797573)
I love what you did here. Great mnemonic!
Re:Lua, a Misunderstood Language by phaedryx on Wednesday January 20, 2021 @01:30PM (#25850053)
ooo, I'm going to steal that; clever.
Re:Lua, a Misunderstood Language by zajio1am on Friday January 15, 2021 @05:36PM (#25797455)
> (which everyone outside of CS does)

In set theory (math foundations), ordinals also start at 0.

Re:Lua, a Misunderstood Language by layer8 on Friday January 15, 2021 @07:38PM (#25798641)
That usage gets awkward though when you want to talk about the offset from one array index to another (and the array is 0-based). In actual (common) usage, the distinction between index and offset is the distinction between absolute and relative positions.
Re:Lua, a Misunderstood Language by Pet_Ant on Friday January 15, 2021 @05:36PM (#25797449)
I think I will intentionally start using this usage. Maybe we can make it a thing. I mean we already have argument & parameter for similar things to make a distinction.