3 ms·
> 1-based indexing is just a silly departure from decades of ingrained thinking This on only true for (not too old) programmers. - Older programmers, taught p
by catwell 10y ago
> 1-based indexing is just a silly departure from decades of ingrained thinking
This on only true for (not too old) programmers.
- Older programmers, taught pre-C, may remember that most languages were typically 1-based (Fortran, Pascal, Algol, Smalltalk...).
- Scientists usually use 1-based notation. I have avoided countless off-by-one by implementing papers in Lua. Matlab is also 1-based, probably because it is a language for mathematicians and scientists.
- In general, non-programmer tend to count from 1 and not 0.
> the only inheritance is prototype-based "classes" that are implemented via gross metatable hacking
If you need to you can implement non-prototypal object models, with metatables or with closures if you don't like them. My recommended object library is https://github.com/kikito/middleclass https://github.com/kikito/middleclass for people who want to write ojbect-oriented code (I usually don't).
> dictionaries masquerade as lists but can unintentionally become dictionaries if you mistakenly put a non-numeric key in them
I agree with this one, mostly. I would appreciate a purely sequential data structure ("list").