[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua distros again
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Tue, 13 Feb 2018 11:46:25 +0100
On 29/01/2018 10:27, Pierre Chapuis wrote:
Is there a list of the best essential libraries for Lua?
I want to bundle a small set of high quality
libraries that I will test with Ravi, rather than a huge set of
untested libraries of varying quality.
From the end of 2013 to the end of 2016 I was running a website
called Lua Toolbox where community members could endorse
the modules they used. The website has been merged into
the main LuaRocks website and sadly this feature has been lost
in the process, but the top 5 modules at the time were:
- luafilesystem
- luasocket
- lpeg
- luarocks
- luaposix
I think they represent what I would expect in such a distribution
pretty well. Maybe not LuaRocks given that you want a different
build system, and maybe winapi as the pendent of luaposix for
Windows users... Some OpenSSL binding is also a must have.
[warning: long post ahead - with some ranting, too]
I think that one of the problem with actual library usage is that the
average Lua (the language) power-user, if I may call him that way, is
that he has been taught to "roll your own", so I suspect he is using
lots of home-brewed code that has lots of commonality with "self-rolled"
code used by other users.
Therefore he really downloads libraries that he cannot (by lack of
expertise or time) roll by himself. LFS is a clear example. It is
symptomatic that no string or table library comes first, although
probably each one of us has some kind of custom-made self-rolled
"stringx" or "tablex" library, because I guess most programming task
involving Lua may well imply non-trivial string or table manipulation.
Hence LFS /appears/ to be the most used library, although you can go a
long way without its functionalities.
This, IMHO, is /the/ big problem with Lua ecosystem. The most common
libraries are actually not published because they are often half-baked
solutions that are too author-specific and not worth maintaining in a
public way (who wants to support his own string library if it hasn't
enough traction from the community?)
It should seem strange that more general-purpose libraries are /not/ the
most downloaded ("penlight", "stdlib"), as if people didn't usually use
those functionalities.
After years of following Lua-l I've seen this discussion coming up
several times. And every time died off or gave rise to initiatives that
lasted just for a short while or didn't gain enough traction to become
de-facto standards. Every time.
Sadly I think this is a direct consequence of Lua team not wanting to
endorse any specific initiative.
I understand their decision of not wanting to create and maintain a "PUC
standard" library collection, and I also understand their attitude
toward backwards compatibility. That's ok. It's Lua team's way.
But there is a big "but": not endorsing, say, a charter of committed
people that took responsibility for creating a basic set of standard
library was and is a big mistake for the future of Lua, IMO.
I still remember some years ago when Lua was considered (I can't recall
exactly the source) one of the three major scripting language, together
with Python and Javascript.
I fear we are steadily losing terrain. I haven't hard data to back up
this feeling, so I may well stand to be corrected (and I'd like to be,
really), but I see lots of news about Python gaining ever more users
among scientists and non-programmers, whereas nothing about Lua outside
very specific "circles".
Mind, I don't think Lua user base is shrinking, on the contrary, I think
it is increasing, but much, much more slowly than other languages.
This means that a widespread diffusion of Lua (as was the intention of
their authors, at least years ago) is not going to happen, IMO.
Even when thinking about embedding a language in an application, where
Lua should be first choice, I hear people talking about Python and using
Python (urgh!)! Sometimes because they don't even know Lua, and
sometimes because they need better supported libraries, so they rule-out
Lua!
I didn't even understand the rationale behind the latest changes in the
language. I did appreciate the addition of "goto" in 5.2 and bitwise
operators in 5.3, but, really, what's the use of the utf8 library in a
language that doesn't support unicode natively (relying on underlying C
reading files in text mode - I know that in Linux that doesn't matter-
but Windows is not a marginal system)? The minimalistic mantra of
keeping unneeded stuff out of the language wasn't applied here. (why?)
Utf8 was an ideal candidate for an external library.
Lua team stripped the math library of world-standard hyperbolic
functions because they were little used (?!?) and they were a simple
forwarding to C libs. "OK, if you are a C programmer you can re-add
them, or you can implement them using exp". Sadly who usually needs the
optimized C versions that map to math processor instructions
(scientists) is typically /not/ a C programmer, whereas a C programmer
rarely uses hyperbolic functions!
Then table.move (good addition but why the complicated usage pattern,
resembling the C memmove, and why "move", when it copies things
around?!? Another wink to C programmers?).
Then also the string.pack/unpack/packsize, things. Why? That may make
sense to some, but is it really a "general mechanism"? For what? The
manual not even explains what is going on:
"The first argument to string.pack, string.packsize, and string.unpack
is a format string, which describes the layout of the structure being
created or read."
What structure? Not even an example is given! And Lua hasn't got any
"structure" datatype. Yes, I know that is some kind of inclusion of
Roberto's "struct" library. Of course a C programmer or someone using
protocols could discover this, but another wink to C programmers and
more unfriendliness toward a novice Lua programmer that is not already a
C programmer. Another very specialized thing (not really a "general
mechanism") that seems well fit for an external library that gets in the
language, instead. Moreover it is a fairly low-level mechanism. Another
thing that doesn't appeal to "higher level" programmers. Why?
Really, I can't understand where Lua is heading in the intention of
their creators. What is the target user base of Lua?
These eternal discussions about a "standard set of library", recurring
for decades and always leading to nothing lasting more than a couple of
years should be a warning for Lua team.
Judging by lua-l alone there are more attempts at creating
customized/patched/jitted Lua variants than to create a set of
standardized libraries having the consensus of the community!
What if Donald Knuth kept TeX for himself and didn't endorse the efforts
of the community to build that enormous, reliable and widespread code-base?
Cheers!
-- Lorenzo
(who still loves Lua a lot, but is ever more puzzled)