tech-userlevel archive

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

Re: Lua as a scripting language in NetBSD

On Sun, Oct 18, 2009 at 03:50:46PM +0200, Marc Balmer wrote:
> Am 18.10.2009 um 15:13 schrieb der Mouse:
>>> Finding one good ("best" is subjective, we shouldn't be seeking that)
>>> scripting language to include in base seems like it might have
>>> advantages, [...]
>> We've already got two or three good scripting languages in base (for
>> lots of use cases' values of "good"; there are use cases they're a  
>> poor
>> fit for, but that's true of any language).  Do we need more?

I think yes.  We don't have anything that's easy to embed in programs
written in other languages.  One nice solution might be awklib built
from our awk, and I could live with that, but I think Lua is considerably
better in several respects.

I don't think what Marc means by 'scripting language' is "language for
scripts to be invoked like executables from the command line".  I think he
probably means something more like "language for scripting the built-in
functionality of other applications".  Lua is meant for this and it is
very good at it.  It is also small and fast and has a suitable license.
It is even practical to embed Lua in the NetBSD kernel, probably even
including the Lua JIT -- which offers considerable benefits for a number
of interesting applications like stateful packet filters.

>> I don't know Lua.  But, based on what's been said here, it sounds to  
>> me
>> like a solution looking for a problem in this context.  Even assuming
>> its touted attributes are real (eg, small libraryable runtime), do we
>> really have a need for such a thing?  I certainly don't recall anyone
>> wishing out loud that we had, for example, an embeddable programming
>> language with a small runtime.

I have a need for such a thing, both in userspace and the kernel.  I
"wish out loud" about it quite regularly, both among other NetBSD
developers and among my coworkers.  And I have heard similar things
from several other NetBSD developers who are or have been involved in
building certain types of products from NetBSD.  I suspect we have all
not been "wishing out loud" where you could hear it (i.e. here) because
none of us have been in the mood for a religious war with the partisans
of various large languages with huge runtimes which are hard to cross
build -- or even certain small languages with small runtimes but
unsuitable licenses and low performance (can anyone say "guile"? ;-).

Almost everyone I've run into who's considered this problem at any
length has eventually converged on Lua as the likely best solution.  I
was a significant partisan of awk for this purpose originally -- but
I have been persuaded.  Look at Lua, play with it, and think about some
of the things you could do with it embedded in other programs and I
suspect you may eventually be as well.

> One goal of my initial mail is to see whether other developers could  
> (and would) make use of it if we had it.  Once I collected a few more  
> ideas and feedbacks, I can work on a more elaborate proposal.

Yes, yes, yes.  And I can probably devote some resources (my time and
that of others) to maintaining it in the kernel as well, if we are
heading in that direction.

Thor Lancelot Simon                               
    "Even experienced UNIX users occasionally enter rm *.* at the UNIX
     prompt only to realize too late that they have removed the wrong
     segment of the directory structure." - Microsoft WSS whitepaper

Home | Main Index | Thread Index | Old Index