[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: So I had this weird idea to solve the indexing problem
- From: Pavel <temp213@...>
- Date: Tue, 11 Jun 2019 02:00:30 -0700 (MST)
Soni "They/Them" L. wrote
> hi, so, a lot of ppl won't use Lua because Lua uses 1-based indexing.
> well, other languages use 0-based indexing. but, what if we had neither?
Use or not to use some particular language only because of array indexing is
absolutely stupid.
Not all the languages have 'native' hardware pointers and thus pointer
arithmetic, with the array index being an offset from the array address, but
not actually index.
e.g. Wolfram Mathematica, Mathlab, R, Julia ...
0-based arrays have last element, which is array[LENGTH-1], instead of
array[LENGTH]. what's the difference where to add/subtract this 1?
ppl could also use 0-based arrays if they like
for i=0,#array-1 do print(array[i]) end
imho nothing to fix here.
--
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html