3 ms·
After 20 years of Python being my main language, I switched to Lua last year, and it felt great. I just felt Python's feature set was becoming too boated, and
by stakhanov 4y ago
After 20 years of Python being my main language, I switched to Lua last year, and it felt great.
I just felt Python's feature set was becoming too boated, and reading other people's code was becoming too much of a cognitive drain, because others don't tend to subset the language in the same way that I would subset it to keep complexity to a minimum.
Also, the larger feature set of Python means that code written in Python doesn't move between environments as easily. With Lua, I can rely on hobbyist implementations running on top of Java (KeraLua/Luna), .NET (NeoLua), JavaScript (fengari), or native (the original PUC-Lua), where the latter in turn has bindings to other languages (like Python). With Python there has been the same amount of appetite to do these things (Jython, IronPython, various JS-based pythons like Transcrypt, etc.) but they just never achieve actual compatibility with CPython for practical intents and purposes.
- _taar 4y agoI've never met anyone who used lua having experienced other languages without growing to hate it. What's an example of good code in lua, that you would enjoy working on?
- stakhanov 4y agoHow many people do you know who used lua, having experienced other languages, and who did grow to hate it? What are the properties of the language that they do hate, specifically? As I've said, my own code is mostly in Lua these days, and I am enjoying working on it. It's closed-source, so I can't point you to it.
- deleted 4y ago[deleted]
- JonChesterfield 4y agoI really like being able to easily statically link libraries into the lua interpreter. Spawn a process using libuv and wrap it in a native coroutine to get concurrent execution with fewer failure modes than normal. Embed sqlite and get a friendly repl over your database. Find some utility written in lua and it's similarly easy to embed. I replaced python with it for misc code generator and admin tasks for that reason. Instead of whatever pip is called these days and global installation conflict nonsense, I can clone a single .c from github that contains lua and all the libraries I've found useful so far. Mostly it just gets out of your way. Compiler feedback isn't wonderful when you get something wrong but it's adequate. Some conventions are a bit weird but it's fine. Lexical closures, garbage collection and native coroutines make up for them.