On 2012-05-13, at 12:59, Andy Armstrong 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.
Zero based arrays and lists and other collections make so much sense in so many ways, including
simplifying iterators and calculations on subranges. When I went from Fortran to just about any
other language in the world including ones written before C was a twinkle in Dennis' eye... I had
about 30 seconds of "WTF" followed by "OMG, why does anyone do it any other
way?"
On the other hand, there's a number of really stupid things I find in other
languages that are obviously just copy and paste from C.
Like "==" for comparison in statement-based languages where "a = b" is not a
valid expression.
Like "==" for comparison in languages that don't *have* an assignment statement.
Like "(type)" for coercion in languages that don't support derived types, so
all the types are one word anyway.
Like "*x" for indirection. Even Dennis agrees that was a mistake. He said that by the
time he noticed it there were three sites using "C" so they thought it was probably too
late to fix it.