News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language by brundolf on Friday January 15, 2021 @05:36PM (#25797453)
Agreed. 1-indexing may be more intuitive for humans broadly, and this may have been a good argument before C became ubiquitous, but when it comes to programmers the landscape of what's intuitive is different; 0-indexing is a deeply ingrained habit. Very few norms are so universal across programming languages
Re:Lua, a Misunderstood Language by goatlover on Friday January 15, 2021 @06:23PM (#25797987)
But it's not universal, since there are established languages like Fortran and R which are 1 based. And Fortran proceeded C.
Re:Lua, a Misunderstood Language by d3ckard on Friday January 15, 2021 @05:53PM (#25797628)
That’s more dependent on language syntax IMO. When you have traditional C-style loops, maybe. When you use ranges, iterators etc. it doesn’t make any difference.
Re:Lua, a Misunderstood Language by brundolf on Friday January 15, 2021 @06:03PM (#25797735)
If Lua is range/iterator-heavy (I haven't used it), then yeah that would definitely ease the burden, but I wouldn't say it doesn't make any difference unless you never ever index anything directly
Re:Lua, a Misunderstood Language by layer8 on Friday January 15, 2021 @07:42PM (#25798677)
It makes a difference as soon as you want to specify a subrange by index.