lua-users home
lua-l archive

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


> On Mar 25, 2017, at 3:53 AM, Joseph Manning <manning@cs.ucc.ie> wrote:
> 
> On 2017-Mar-25 (Sat) at 12:42 (+0200), steve donovan wrote:
> 
> Steve,
> 
>   Yes!  In fact, 1-based indexing is one of the ( several ) reasons
>   that I like Lua.  I detest either using, or teaching, the unnatural
>   "0 to length-1" pattern of many other "high-level"(?) languages.
> 
>   But you're right -- "each to their own".  0 versus 1 debates are
>   similar to emacs versus vi debates :-)
> 
> Joseph
> 

To my mind both have their place. 0-based indexing makes perfect sense in C, where indexing is little more than syntactic sugar over pointer+offset anyway — but really that’s because C was designed (to my mind) as a reified assembly language anyway. However, once you get into higher abstractions (such as any decent script language) 0-based ceases to have much validity imho.

—Tim