News for hackers. Stuff that matters.
Re:Nelua Programming Language by romwell on Tuesday August 24, 2021 @06:11PM (#28295617)
One solution to that is have inherently modular array indexing, so that any index is valid.

If A[1] is the first element, then A[0] would be the last; etc

Re:Nelua Programming Language by mst on Tuesday August 24, 2021 @06:24PM (#28295742)
I do appreciate languages that allow -1 for the last index.
Re:Nelua Programming Language by layer8 on Tuesday August 24, 2021 @06:30PM (#28295794)
That makes it difficult to calculate the distance (length of the slice) between two arbitrary indices though.
Re:Nelua Programming Language by romwell on Wednesday August 25, 2021 @03:14AM (#28298834)
Well, that's when you can use the mod operator instead of having to do it when indexing into an array (a much more common operation).
Re:Nelua Programming Language by 0-_-0 on Wednesday August 25, 2021 @05:56AM (#28299640)
That's a good idea!