News for hackers. Stuff that matters.
Re:We need less powerful languages (2015) by stakhanov on Thursday February 02, 2023 @12:56AM (#34622667)
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.

Re:We need less powerful languages (2015) by AlexAndScripts on Thursday February 02, 2023 @03:43AM (#34623881)
I'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?
Re:We need less powerful languages (2015) by stakhanov on Thursday February 02, 2023 @03:49AM (#34623930)
How 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.

Re:We need less powerful languages (2015) by AlexAndScripts on Saturday February 11, 2023 @04:00PM (#34756293)
About a dozen? The default statement when it comes up is "god I hate it, it's time for a better designed easily-embeddable language". It doesn't have any kind of mechanism for sane organisation of code, I vaguely remember it having bizarre types, arrays start from 1, the syntax is incredibly tedious, the errors are bad, how could I forget global-by-default variables, ... I get that it's easy to embed, but I find it to be a complete pain to work in.

I've probably written Lua for about 15 hours in various contexts, and I've never enjoyed it.

I haven't written in it for a while though.

Re:We need less powerful languages (2015) by JonChesterfield on Thursday February 02, 2023 @05:54AM (#34624909)
I 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.