4 ms·
This comment thread on the previous conversation has a lot of good replies: https://news.ycombinator.com/item?id=31908731 https://news.ycombinator.com/item?id=
by bcrescimanno 4y ago
This comment thread on the previous conversation has a lot of good replies:
https://news.ycombinator.com/item?id=31908731 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.
- alex_smart 4y ago> People don't like Lua (or just simply prefer VimScript) :shock:
- Beltalowda 4y agoI 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.
- TheCycoONE 4y agoFair, though neovim uses LuaJIT which is maintaining Lua 5.1 compatibility indefinitely; with their own set of extensions[1]. 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 https://luajit.org/extensions.html [2] https://github.com/CorsixTH/CorsixTH/blob/master/CorsixTH/Lua/strict.lua https://github.com/CorsixTH/CorsixTH/blob/master/CorsixTH/Lu...
- dvogel 4y agoI feel the same way. Legacy vimscript certainly had some warts but vim9script has been much nicer IME than lua. Elsewhere I've likened vim9script to typescript 1.0. It has just enough types to be useful but not enough to let you go down a rabbit hole. That's sort of the sweet spot when scripting another application.
- mayama 4y ago> Lua, on the other hand, won't give me an error if I mistype a variable name, Lua has pretty good lsp server and it gives me good warnings and completions.
- sodapopcan 4y agoI prefer vimscript when scripting vim.
- Macha 4y ago> * People don't like Lua (or just simply prefer VimScript) Lua is not my favourite language, but I'd sure take it over vimscript.
- krylon 4y ago> People don't like Lua Who doesn't like Lua? That is right up there next to disliking kittens and puppies...
- azangru 4y agoArrays start at 1?
- oblio 4y agoJust like in math, and Lua doesn't do manual memory management so aligning stuff with memory addresses is not needed. They're both valid options and it's just about preference.
- layer8 4y agoThere are good reasons for zero-based indexing outside of pointer arithmetics: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...
- int_19h 4y agoIt's a well-known argument. It's also widely recognized as highly subjective, starting with the notion that upper bound must be exclusive.
- threatofrain 4y ago> Just like in math 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.
- xigoi 4y agoIndexing starts at 1 in math mostly because in history, people were afraid of 0, and it's hard to change conventions.