[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why isn't Lua more widely used?
- From: Francesco Abbate <francesco.bbt@...>
- Date: Sat, 28 Jan 2012 16:07:09 +0100
2012/1/28 sergei karhof <firstname.lastname@example.org>:
> Why isn't Lua more widely used?
> Granted, being a script language, Lua can only hope for a niche
> position, and can never become as popular as C or C++.
> instance? Could not Lua be used in browsers and do as much a good job
Lua cannot replace C or C++ for application where performances are
important. This is changing a little bit with LuaJIT2 but still we
cannot replace C/C++ in many cases. Using strong static typing C and
C++ can often generate code that is near-optimal for a given
architecture. The compilation is done only once and you can make sure
that the code is optimal. With a JIT you are always at the merci of
the JIT. In addition C/C++ are not garbage collected so you can often
optimize the memory allocation strategy and you can also allocate
objects on the stack. You can also optimize a lot of things tha with
Lua you cannot manage yourself.
is the standard scripting language supported by browser and it is also
still have a prominent position because you cannot choose the
quite similar but I consider that Lua is just better because it does
If we limit ourselves to the niche of stand-alone dynamic programming
language still Lua is much less used that Python and Ruby. I'm using
myself also Python at work for some tasks instead of Lua. The reason
to prefer Python to Lua is: the standard set of libraries are very
complete and of very good quality: you have many things already there
out of the box, you need just make sure that python itself is
installed. Python is also a richer programming language than Lua, so
often you can write compact elegant code where with Lua often you need
to be more verbose. For example in Python you have list
comprehensions, list generators, generator functions, a more complete
exception mechanisms. Of course this have a cost: Python is more
complex, it is slower and bigger. It is therefore more difficult to
have good JIT and it is difficult to embed because it is quite a big
beast. Lua chosen the simplicity instead of the number of features and
complexity. This have paid in the sense that Lua is lighter and more
easy to embed but the downside is that it does not have all the
elegant features of Python.