Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Eh... I'm not convinced on the argument of offset != index, because the reality beneath arrays and lists is that it is offset based.

Arrays are the obvious one: assuming no associated metadata they are an address to the first (zeroth?) element.

Even things like linked lists are essentially offset based: It's an address of the first (zeroth) node. The next node is 1 node away from that.

In general I don't think it is a good idea to abstract too far away from how things actually work. And in that sense, 1-based indexing in LUA does make sense since LUA is table based and '1' here is an arbitrary identifier.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: