lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, 18 Jan 2020 at 17:21, Steve Litt <slitt@troubleshooters.com> wrote:
IMHO in this day and age, you need a language that can easily and
reliably and without experimentation interact with XML, HTML(5), Xhtml,
databases, JSON, YAML, DOM, sockets, IPC, complex numbers, and probably
twenty other things I haven't thought of yet. And with small appliance
devices doing ever more mainstream things, some of these batteries will
probably become more important, in embedded programming, in the future.

This is both a blessing and a curse. Having them available is one thing, having them as part of the language is not. My favoured language is Ruby, I can do quite a lot with just the core language before having to reach for a library, usually for JSON, XML or database access. Lua however has me reaching for a library (in the loosest sense) for things that are part of the core language in Ruby. Ruby is convenient when knocking out code but it comes with both a performance hit and massive memory footprint. That is a tradeoff I understand and can live with

With Lua I have amassed a small library just to do the sort of things that are a given in languages like Ruby and Python even before you consider things such as JSON, XML and databases. Which slows me down as I constantly have to find which library to pull in. For this I get better performance (I have converted applications from Ruby to Lua for the performance boost) and a much smaller memory footprint. Again a tradeoff I understand and can live with

I use Lua and Ruby (and C) not because they are the same but because they are different. I no longer program in Perl as it does nothing that Ruby can't. I only use Python when some esoteric module is needed or I am dealing with 3rd party code. But when I want to try something out Lua is a good choice unless I envision serious string mangling or that something OOP may be the best solution

Lua is a simple and powerful language. Think JSON vs XML. JSON is in many ways a deficient standard compared to XML but amazingly useful. XML allows much more control and reduces ambiguity but at a cost

JSON wouldn't become better if it got 'feature envy' for XML. Lua will never be a better Python than Python, and will probably be worse for trying
 
So, in my opinion, Lua would greatly benefit from an official, blessed,
curation of libraries available both in a single package for when disk
space isn't at a premium, and a-la-carte for embedded.

Although I get pissed when searching for an existing Lua library to do some task to find either zero or six. Not having standard libraries is not necessarily a bad thing. In other languages the standard / default library for something tends to have a kitchen sink set of features just in case someone might need feature X. This comes at a cost, the codebase is larger, it has codepaths that are addressing features you have no interest in, hitting performance and eating memory. More code means more possible bugs. Just look at the standard Python logger. It is truly a marvel of engineering. Of which I use at most 10% but the remaining 90% is baggage my application must carry. Same with Ruby, every unused language feature is hitting performance and eating memory

I found four logger libraries for Lua but ended up writing my own (so now we have five). The evaluation and eventual development of my own solution slowed down development (with Ruby or Python there is no real choice, just read the docs and write code) but I have a solution that does exactly what I want. It does it as fast as possible. It uses the least memory possible and being small (54 lines including comments) it is not going to be difficult to hunt down any bugs. The very reasons I selected Lua for that project, these are Lua's strengths

To compete with Python or Ruby or any other general purpose language Lua needs to be clearly better than them otherwise there would be no good reason to switch. I left Perl for Ruby because I was doing a lot of OOP and Ruby did that sooooooo much better. If Lua started to get more like Ruby and less like the current Lua I would probably ditch Lua. Why use an inferior clone of Ruby when you can use Ruby?

I use a set of languages not because they are the same but because they are different. Each language and their ecosystem has different strengths and weaknesses and so are better fitted to solve particular problems. Convergence is not a good thing in this case, not just the language but the ecosystem too

Sorry for the ranting, it is probably not as coherent as I hoped