Another tool for updating /etc -- lua||other script language bikeshed

Ivan Voras ivoras at freebsd.org
Wed Mar 24 22:05:21 UTC 2010


On 24 March 2010 20:03, Peter Jeremy <peterjeremy at acm.org> wrote:
> On 2010-Mar-24 14:11:21 +0100, Ivan Voras <ivoras at freebsd.org> wrote:

> There's awk (though it's somewhat restricted in its abilities to do
> anything more than text manipulation) but in principle, I agree.  The
> requirements as I see them are (in no particular order):
> - BSD-compatible license
> - must be compatible with buildworld (primarily, it must be possible
>  to cross-build)
> - contains a critical mass of users in the FreeBSD developer (and
>  ideally committer) community
> - language must be reasonably stable - will a script written today still
>  work correctly in (say) 5 years.
> - must be acceptable to the vast majority of the user base (no religious
>  wars allowed)
>
>>There was once Perl in base and even though I personally dislike Perl at
>>least it was a standard of sorts and guaranteed to be there if needed.
>
> It was removed because it didn't support cross-building (buildworld is
> always done as a cross-build) and was evolving at a rate incompatible
> with the base system.
>
>>As a possible alternative, or at least to learn about others' opinion on
>>the subject, I'd like to suggest Lua (http://www.lua.org/).
>
> As someone who has never used Lua, how well does it meet the
> requirements above?

I would also like to avoid holy wars so I really want this to be
discussed. I'm more pushing in the direction of "give us something
nicer than sh" than I'm specifically pushing Lua.

To the best of my knowledge, the answers to your questions for Lua are:

> - BSD-compatible license

it's MIT-licensed.

> - must be compatible with buildworld (primarily, it must be possible
>  to cross-build)

I'm not sure what you mean by "cross-build". If you mean it needs to
support some specific compiler magic, then I don't know. I do know
this: its src directory is flat (32 .c files, 23 .h), its Makefile
basically says "compile all these .c files into an executable or a
library with CC options varying by platform", and it's ported to at
lest these operating systems: aix ansi bsd freebsd generic linux
macosx mingw posix solaris - the presence of solaris indicates 64-bit
and big endian - aka the big portability test.

I've just verified that a working executable can be compiled with "gcc
-o lua -lm *.c" (if you remove the "luac.c" with duplicates a main()
in addition to the interpreter "lua.c").

> - contains a critical mass of users in the FreeBSD developer (and
>  ideally committer) community
> - must be acceptable to the vast majority of the user base (no religious
>  wars allowed)

Have no idea. Possibly the biggest single obstacles unless they're
modified to "has the biggest number of people not specifically
objecting to it"

> - language must be reasonably stable - will a script written today still
>  work correctly in (say) 5 years.

The Wikipedia entry for it
(http://en.wikipedia.org/wiki/Lua_%28programming_language%29) says
it's been started in 1993. AFAIK it has always been backward
compatible and the recent version is 5.3. One thing I remember it for
is that many Windows games (including some classics like Baldur's Gate
II... I'm sure some people remember it) were scripted by it.

I'd like to summarize why I think Lua is a good idea here:

* Small footprint (150-200k executable). Can be compiled with gcc -o
lua -lm *.c.
* Can be embedded into C apps for scripting, can use C for extending
it (designed to make both directions trivially easy)
* Is kind of like Python (supports OOP, partly functional, etc.
styles) without the extensive libraries. (but has no "significant
whitespace" issue).


More information about the freebsd-hackers mailing list