34 ms·
Lua uses 1-based indexing because its initial userbase were engineers used to FORTRAN. As for ~=, you need to keep in mind that Lua goes all the way back to 19
by ufo 8y ago
Lua uses 1-based indexing because its initial userbase were engineers used to FORTRAN.
As for ~=, you need to keep in mind that Lua goes all the way back to 1991 and back then there wasn't a big pressure to make your syntax look like C (of Java or JavaScript) like happens today. Syntax used to be much more varied.
- int_19h 8y ago~= is a poor choice in and of itself, because it doesn't have any clear justification. It would make some marginal sense in C, where it's binary negation, but that's not the case in Lua - it only ever uses ~ to mean "not" in that one context of inequality. And, on the other hand, ~= looks too much like an attempt to spell out ≅ in ASCII, but the meaning is completely different. If anything, /= (as used in Algol-68, Ada, Eiffel etc) makes a great deal more sense as an obvious rendering of ≠. It's unfortunate that C confused matters by reusing it as assignment.
- scns 8y agoHaskell uses /= too