|
|
|
|
|
by Beltalowda
1455 days ago
|
|
I prefer VimScript over Lua. VimScript is really not that bad of a language and I think its deficiencies have been greatly exaggerated, and Vim9Script fixed most of the oddities that were in there (e.g. '1' == 1 and such, JS/PHP-style). 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...