News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language (2021) by ok_dad on Thursday September 29, 2022 @02:45PM (#33025305)
It was arbitrary in that they chose to use a leaky abstraction to make it easier for themselves to make arrays using their memory model. The first person to do this could also have subtracted one from the user’s index to get the memory offset.
Re:Lua, a Misunderstood Language (2021) by jabbawookiees on Friday September 30, 2022 @05:39AM (#33032848)
Or they could have saved themselves a CPU cycle every time they needed to index an array.

Don't get me wrong, non-zero-cost abstractions are great when they improve developer ergonomics commensurate to how much they cost. Garbage collection at the expense of GC overhead? Yes please. Classes and methods and inheritance at the expense of vtable lookups? Sure!

One-indexed arrays at the expense of either giving up the memory of the first item or always subtracting every index operation? Eh... I think I'd rather count from zero.

Re:Lua, a Misunderstood Language (2021) by nocman on Saturday October 01, 2022 @11:52AM (#33047492)
That's not what arbitrary means.

Arbitrary means there was no logical reason behind the choice, they just picked one. You can dislike the reason all you want. You can disagree with their choice, or think there are more important reasons to choose what you think they should have chosen, but that doesn't make their choice arbitrary.