lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 3/31/2018 10:31 PM, Enrico Colombini wrote:
On 31-Mar-18 14:24, Doug Gale wrote:
​I hate one-based indexing​. It adds a ton of confusion when embedding lua into a native programming language project, and tarnishes what I'd consider to be a fantastically good language otherwise.

I started with 6502 assembly (0-based) then learned BASIC (1-based) then C (0-based) then Pascal (1-based) then... well, you get the idea :-)

After a while you just get used to think in the context of the language you are writing in, even when you are mixing them in the same project.

As Marc Balmer said, it is the same as for human languages.

+1, folks who react badly to 1-based indexing may be loud on blogs and other places, but there are plenty of people who use multiple programming languages just fine.

But because discussions are often about possible defects or perceived defects, such 'negative' issues are over-represented.

Coders who think indices cause problems should abstract it away in some sort of container or object, like the range loops that Stroustrup recommends in C++, then nobody will get hurt.


--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia