Re:Python and Lua (2019)
by rstuart4133 on Sunday October 10, 2021 @07:30PM
(#28822915)
Lua is optimised for interpreter size, Python for "language niceness / flexibility", and it shows. Lua has lots of nits, such as the index starts at 1 thing, or the "all numbers are floats" thing. I also find its class mechanism ugly, but the most annoying one for me is it suffers from the totally unnecessary "a variable is global by default" bug.
However, life is full of unexpected surprises. While Lua small engine size was a deliberate strategy to make it cheap to embed, it also meant it's much easier to optimise than something the size of Python. And ... that's what happened, so LuaJit is the fastest interpreted language - even faster than the best javascript engines when I last looked. That despite javascript engines having had man decades of optimisation effort put into them.
Re:Python and Lua (2019)
by portaltonowhere on Sunday October 10, 2021 @08:09PM
(#28823142)
FWIW, Lua 5.3 (released in 2015) introduced integers. But agree with the rest.
Some years ago when Squirrel started to get traction, particularly due to its adoption in a couple of IoT frameworks, I fiddled with it for some months and it almost got its way into a commercial electronics project. However by then uPython was getting more popular, had better tooling support and ARM microcontroller chips had become very fast. Being able to reuse the same code on the host with minimal or no changes, or having an interface or emulation layer that you can also program in Python is a game changer. It took me less than a week to rewrite the Squirrel code to Python, with even better features thanks to the language facilities.
I thought I was never going to touch Lua again but a couple of months ago I found myself hacking some REAPER audio processing scripts, and cursing Ierusalimschy once more for his decision on neglecting Dijkstra's advice and not starting indexes from zero...