Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Mar 2010 23:04:58 +0100
From:      Ivan Voras <ivoras@freebsd.org>
To:        Peter Jeremy <peterjeremy@acm.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Another tool for updating /etc -- lua||other script language  bikeshed
Message-ID:  <9bbcef731003241504k105c0c3bh977ac4e78b350186@mail.gmail.com>
In-Reply-To: <20100324190310.GC88991@server.vk2pj.dyndns.org>
References:  <201003231108.45102.jhb@freebsd.org> <hod31p$qlc$1@dough.gmane.org>  <20100324190310.GC88991@server.vk2pj.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 24 March 2010 20:03, Peter Jeremy <peterjeremy@acm.org> wrote:
> On 2010-Mar-24 14:11:21 +0100, Ivan Voras <ivoras@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. =C2=A0Th=
e
> requirements as I see them are (in no particular order):
> - BSD-compatible license
> - must be compatible with buildworld (primarily, it must be possible
> =C2=A0to cross-build)
> - contains a critical mass of users in the FreeBSD developer (and
> =C2=A0ideally committer) community
> - language must be reasonably stable - will a script written today still
> =C2=A0work correctly in (say) 5 years.
> - must be acceptable to the vast majority of the user base (no religious
> =C2=A0wars 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).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9bbcef731003241504k105c0c3bh977ac4e78b350186>