[dev] promoting suckless code on RosettaCode.org, tips for Lua

From: Greg Reagle <list_AT_speedpost.net>
Date: Wed, 12 Jun 2024 19:03:04 +0000

I like to demonstrate suckless-style code (by which I mean simpler, fewer lines, more elegant) on RosettaCode.org. I have found overly elaborate and complex code that I have either replaced or supplemented with a simpler implementation. I encourage the rest of you to take a look and see what you can do. I am very pleased that I can choose whatever language I want. If any of you want to collaborate or inquire I welcome your emails.

Here is a case in point: https://rosettacode.org/wiki/Word_wheel#No_metatables,_simple

And while I have your attention... What a great language Lua is! Of course it is not for every purpose, but for a high-level interpreted language, it is the bee's knees. Lua is a very loosey-goosey language, which has some disadvantages. To make it a bit more "strict" and careful, I recommend 2 tools: luacheck and penlight strict. Luacheck is a command (available from LuaRocks) that checks the code like lint. And when you have Penlight library installed (also from LuaRocks) you can add "-l pl.strict" to your lua command line. Neither command requires any change at all to the Lua (source) file meaning they both work on standard plain Lua.

And as a bonus, I also recommend argcheck by geoffleyland (see LuaRocks) which enables type-checking of function parameters via comments, so that the Lua code works just fine with a standard Lua interpreter.
Received on Wed Jun 12 2024 - 21:03:04 CEST

This archive was generated by hypermail 2.3.0 : Wed Jun 12 2024 - 21:48:09 CEST