If you search the forums, this fundamental issue is mentioned thousands of times over years and years.
Which leads me to a naive question: Lua is open sourced. Why hasn't anyone in the world just forked the language to be 0-based? Is it not as simple as it sounds? I don't know what goes into designing and compiling a programming language, so it seems like such a trivial fix for what appears to be the #1 issue for every person out there allergic to Lua.
It isn't.
Having worked with languages that have both 0- and 1-based indexing (sometimes at the same time), this is at the bottom of my concerns when evaluating a language. It's the "tabs vs spaces" of programming language comparison. Right there with "does it have semicolons" and "is whitespace significant". None of these things are important.
I've never gone too far deep into 1-based languages, but it seems like it would avoid a lot of off-by-one errors once you get used to it.
It's only in C and C++ where the memory location of an element can be expressed as base+offset that we end up using the offset rather than an index. That has clear logic behind it and absent optimising compilers it may be marginally more efficient, but it does not make for the most user-friendly interface--it does break the expectations of most other people.
If I'm working on providing a Lua library interface for non-developers, they will find the default Lua behaviour far more natural than were I to force zero-based indexing upon them.
There is also nothing wrong with One based indexing. Zero based indexing exists for historical reasons and because most people are comfortable with it they feel uncomfortable with the alternative, that is easily overcome though.
As an aside, the One based indexing is the mathematical convention, which is why e.g. MATLAB consciously choose it.
>Why hasn't anyone in the world just forked the language to be 0-based?
Significant amount of effort for an extremely minor change.
> If you search the forums, this fundamental issue is mentioned thousands of times over years and years.
> Which leads me to a naive question: Lua is open sourced. Why hasn't anyone in the world just forked the language to be 0-based? Is it not as simple as it sounds? I don't know what goes into designing and compiling a programming language, so it seems like such a trivial fix for what appears to be the #1 issue for every person out there allergic to Lua.
I wonder how many of those who complain have actually used Lua? Same with all the Perl/PHP haters...
It’s not the only big 1 indexed language (R, COBOL, Wolfram, Smalltalk, etc.), sometimes as engineers we just have to get used to idiosyncrasies between languages similarly to how bilingual people do the same with spoken language.
Damn, wait till you work with... Well, just about any language.
To be clear: I love Lua; but if you're going to have a reaction, please react to the features that are genuinely counterintuitive, rather than (if you will) counter-counterintuitive.
Seriously now: it can be done, but would be a massive waste of time.