[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lists with nil play nice for Lua 5.2
- From: John Belmonte <john@...>
- Date: Thu, 09 Aug 2007 21:20:59 -0400
Jerome Vuarand wrote:
>> http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
>
> In this paper he says that 0-based indexing is better if you use
> convention 'a' (loops of the form 'for (i=0; i<N; ++i)'). Lua uses
> convention 'c' (loops of the form 'for (i=1; i<=N; ++i)', or in Lua 'for
> i=1,N do'), so 1-based indexing is more suited to Lua.
That is a recursive argument. Lua uses convention "c" because it has
1-based indexing. The choice of index base drives how you specify
ranges. No sane language or library would mix 1-based indexing with
half-open ranges, or 0-based indexing with closed ranges.
--John