[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Updated uFAQ (Unofficial Lua FAQ)
- From: Axel Kittenberger <axkibe@...>
- Date: Tue, 30 Aug 2011 17:37:01 +0200
Here, that was where I was shot down in my conclusions from 1-based
arrays Lua being a language that tries to be easy or native to how
people think / newcomers to coding. Here the reasons behind
1-based-arrays were explained not be any "make Lua an easy language"
strategy, but it was purely coincidental/historical.
On Tue, Aug 30, 2011 at 3:57 PM, Roberto Ierusalimschy
>> Because *people* count from one, not zero.
>> We do that in kindergarten, in music, when starting a race, when drawing
>> up an agenda, everywhere. One, two,three, etc have their counterparts in
>> every known language on earth.
>> Zero, on the other hand, is an advanced concept. Humanity could prove
>> that sqrt(2) is not a rational number centuries before anybody thought
>> that a symbol for zero might be useful.
>> A harder question would be "why do arrays in some other languages count
>> from zero not one?" The answer for C is a good one: "so that *(A+k) and
>> A[k] mean the same". For Python, the answer seems to be "because it's
>> that way in C".
> I am going to discuss a little about 0-based x 1-based in my talk at the
> Lua workshop, and my slides have exactly these arguments!!
> | Currently, many languages are 0-based due to influence from C.
> | Ironically, none of them share the reason that made C 0-based
> | (where a[e] means *(a+e)).
> (I also added: "However, several other languages are 0-based without
> that influence. Examples include Scheme, Oberon, and Haskell.")
> -- Roberto