On Mon, May 14, 2012 at 10:54:39AM +0100, Tony Finch wrote:
> Andy Armstrong <[email protected]> wrote:
> > On 13 May 2012, at 18:48, Michael G Schwern wrote:
> > > * Lists count from 0
> > > * Everybody does it
> > > * Everybody's wrong
> > > * See also "let's just paste what C does"
> >
> > I find it very hard to live with Lua's 1-based arrays. I don't think
> > it's just familiarity - lots of index calculations work out
> > significantly more verbose and ugly with 1-based arrays.
>
> There are good reasons to prefer a zero base with an open upper bound.
>
> http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
>
It's worse if languages don't do it consistently:
for (X .. Y) {
...
}
not equivalent with
for ($_ = X; $_ < Y; $_ ++) {
...
}
Abigail