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 Sat, Oct 17, 2009 at 06:53:57PM -0400, matthew sporleder wrote:
 > > I'm not sure I understand this. Isn't pkg_install mostly compiled C
 > > code? Is the goal to rewrite it in Lua instead of C?
 > 
 > As this discussion shows, the only real answer is to include all (or
 > many) popular scripting languages, or none.

I don't agree. For pkgsrc, sure, but they're all there already. For
base, it's a specific question of what we, meaning the NetBSD
developers and contributors, want to use to write parts of base in.
There's no particular reason to pick anything on grounds of
popularity; the choice should be made based on technical quality, both
of the language as a language and of the implementation as a code
artefact.

I have nothing against Lua in the abstract, or even in the fairly
specific, and it has a specific attractive property: it embeds nicely
as a control language for larger applications. If we wanted to extend
atc(6) with user scripts it'd be a fairly clear choice, for example.
On the other hand, I don't (yet) see a compelling case for this in
base. Unix is natively based on small programs, which are most
naturally combined with a shell. We have a few large applications
hanging around, like gdb, but most of these are third-party and many
of them (like gdb) are already internally scriptable. So I'm not sure
there's any great use for this.

As a language for implementing random parts of base, rather than
specifically for embedding, the primary advantage of Lua seems to be
that it's neither Perl nor Python (both of which have hater clubs)
while still being relatively sane, plus it's small. This is enough to
make it an adequate choice, but it doesn't make it an especially
attractive choice. That is, if we needed something right away, it'd
do, but there's no compelling evidence that we do and it's not
particularly compelling on its own.

If I were the one rewriting pkg_install or sysinst or other pieces of
userland, I don't think I'd rush to embrace Lua for it; Lua is
essentially a beefier awk, which is fine for what it does, but it
AFAIK mostly lacks the language-level abstractions and features (and
libraries) that make high-level scripting languages appealing.

Myself, I'd prefer something statically typed.

 > Extend awk for a more robust scripting environment

That's basically what Lua is.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index