News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language by alentist on Saturday January 16, 2021 @03:54PM (#25805417)
2. How is (c) better for calculating range size if you're using 1-based?

3. "But how do you have two adjacent ranges when they both have the same starting position?" What do you mean?

Consider the length n prefix of a sequence. With 1-indexing, for n = 0, we have sequence[1:0], which means

a. The end position is before the start position (?!).

b. We have to use 0 anyway.

Re:Lua, a Misunderstood Language by Jtsummers on Saturday January 16, 2021 @07:24PM (#25806867)
In (c) with 1-based ranges the size of the range is present in the range. There is no calculating because the value is there. 1 <= x <= size

One argument for the notation (not 0 vs 1 based ranges) is that notation (a) offers easier detection of adjacent ranges. This is irrelevant to the 0 and 1 based range debate.

Re:Lua, a Misunderstood Language by alentist on Wednesday January 20, 2021 @02:26AM (#25843528)
A range doesn’t have to start at 1.