lua-users home
lua-l archive

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


Ken Smith wrote:
[...]
> - real programs
>   In the future, when I write a program in C or C++, I will do all I can to
>   write the bulk of it in Lua and only use C/C++ to expose otherwise
> unavailable
>   system internals.

Likewise. IMO, Lua is fast enough and small enough to support writing the core
logic for just about any reasonable application. I wouldn't say it's perfect;
the lack of strict typing and compile-time checking means that scaling up a
Lua program is less easy than one might hope; the extreme RAD-ness of the
language does tend to lead to unmaintainable messes if you don't enforce
coding discipline; actually adding an interpreter to an application is
significantly harder than it should be...

But on the whole, Lua lets me *get the job done*.

My current project is a build tool called Prime Mover, which is not unlike
make. It's designed to be deployed with the applications that use it, and is
written in Lua. pm steering files are Lua scripts. It's 1600 lines of code and
is scarily powerful; it already vastly outstrips make in terms of sheer
extensibility and functionality (although it does work in a rather different way).

And the good bit? Lua is so tiny that I can get around the problem of the user
needing to install Lua before being able to use pm by including a copy of the
Lua interpreter with every copy of pm! The main binary is a 100kB shell script
which contains the pm Lua script itself, but also the Lua interpreter source
(massaged to be a single stand-alone C file). When you run the shell script,
it unpacks the source file, compiles it, and runs the Lua script, all without
the user's intervention. The bootstrap process, which happens only once, takes
about five seconds on my low-end PC.

I don't believe there is *any* other interpreted language that supports that
sort of thing!

-- 
+- David Given --McQ-+ "Gaping from its single obling socket was
|  dg@cowlark.com    | scintillating, many fauceted scarlet emerald..."
| (dg@tao-group.com) | --- Jim Theis, _The Eye of Argon_ (spelling
+- www.cowlark.com --+ original)


Attachment: signature.asc
Description: OpenPGP digital signature