https://news.ycombinator.com/item?id=31908731
A few highlights:
* "If it ain't broke, don't fix it"
* People don't like Lua (or just simply prefer VimScript)
* Divergence over time means that they are not still compatible.
https://news.ycombinator.com/item?id=31908731
A few highlights:
* "If it ain't broke, don't fix it"
* People don't like Lua (or just simply prefer VimScript)
* Divergence over time means that they are not still compatible.
Lua is not my favourite language, but I'd sure take it over vimscript.
:shock:
Lua, on the other hand, won't give me an error if I mistype a variable name, and the ecosystem doesn't really have good static analysis tools to catch these kind of silly errors. There's some other things I don't like either, like how "arrays" are really just hashmaps, as well as some other things. The whole versioning story wrt. compatibility is also annoying (it's basically a Python 2/3 story with every single Lua version).
It's not Lua is horrible, but the fawning over it from some Neovim people is something I always found curious, like it's a fantastic brilliant language. Meh, I found it quite average overall, at best. And if I look at some Lua vimrcs or plugins then it's all a lot more verbose and awkward than VimScript.
Not that VimScript is perfect by any means, but overall I find it's quite a decent DSL for an editor.
Through the use of metatables you can improve the undeclared global situation[2], through I admit it's kludgy.
We use luacheck for static analysis, but I'll admit it's far from perfect. The language doesn't lend itself well to static analysis.
I think what lua mostly has is a really good embedding story. It's a tiny C library with broad compatibility and a permissive license; and with LuaJIT it's also very fast (though less portable). This means it's used everywhere and a lot of people are at least passingly familiar with it. Vimscript on the other hand is fairly alien.
[1] https://luajit.org/extensions.html
[2] https://github.com/CorsixTH/CorsixTH/blob/master/CorsixTH/Lu...
Lua has pretty good lsp server and it gives me good warnings and completions.
Who doesn't like Lua? That is right up there next to disliking kittens and puppies...
They're both valid options and it's just about preference.
I might be wrong, but I think math favors different starting indices based on the subject matter. I've seen Analysis textbooks favor 0 as the starting index. I don't think there's a clear argument for cultural transference from math.
I'm opposed to starting index from 1 because I think departure from very mainstream programming tradition should have a strong reason beyond preference, even if the de facto tradition appears equally capricious.
Saying the "the zeroth element" is just... weird and slightly nonsensical.
1 is something and it fits very well for the first position... outside of programming :-)
In 0-based indexing, the index of an item is the number of items you've already seen, excluding the one you're looking at.
Aesthetically, it is repulsive, but when actually writing code in Lua, it was not much of a problem. I felt much stronger about "do"/"then" and "end" versus curly braces for delimiting blocks.
~= instead of !=
# instead of len()
Default declaration to global
-- for comments
Dereferencing something that doesn't exist returns nil