4 ms·
Lua and vimscript are both the same age; Lua came out in 1992, and vimscript in 1991, so it would not have been an obvious choice. I think that vimscript has th
by MichaelMoser123 5y ago
Lua and vimscript are both the same age; Lua came out in 1992, and vimscript in 1991, so it would not have been an obvious choice. I think that vimscript has the same problem as shell scripts: there are a lot of editor/shell commands, and they didn't want to introduce a special syntax for distinguishing between the language proper and the editor commands.
I don't think that vimscript is that bad. What i don't like about are the scope rules, i.e. special prefixes for function arguments, locals and globals. Also the call keyword is required for function calls and let keyword for assignments.
Anyway, Python can be used as a vim extension language, i am not sure if Lua is superior in this respect to python.
- ncmncm 5y agoLua is probably way, way faster. Does that matter? It could matter. It would be awful if it did matter, and you chose wrong.
- MichaelMoser123 5y agoWhat would cause such a performance difference? I thought that both lua and vimscript were interpreted languages. (asking as a long time vim user, really curious about it)
- ncmncm 5y agoLua is JITed nowadays. Python has numerous design gotchas that force it to be slow. (But Numpy manages to work around many of them, and be fast.)
- MichaelMoser123 5y agoInteresting. With java the just in time compiler starts to work, if you have iterated several thousand times over the same spot (java cmd line option -XX:CompileThreshold sets this, the default 10000 by default for hotspot server) Interesting if lua has a similar thing... have to learn more about it.
- ncmncm 5y agoJITs are more-or-less portable now. Lua's, like most, probably came originally from some Javascript's. But of course they all trace back conceptually to HotSpot in the '90s. Even Guile Scheme is JITted now, though it probably shares no code with the others. The term "JIT" is getting abused lately to describe what happens to users' eBPF code that runs in the Linux kernel, and Wasm that runs in browsers. In those, all types are known statically, code is compiled to a portable form offline, and transcribed to machine code before any execution, and none of the runtime instrumentation, analysis, and progressive rewriting occurs.
- MichaelMoser123 5y agoCorrection: cpython, the reference implementation of python, does not have a JIT; however Pypy does have one.