lua-users home
lua-l archive

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


Matt Campbell wrote:
The following quote from the recently published Computerworld interview
with Roberto caught my attention:

Question:  Where do you envisage Lua's future lying?
Answer:  Scripting. <snip> scripting language, as its
name implies, is a language that is mainly used for scripting. The
origins of the name are the shell languages that have been used to
script other programs. Tcl enlarged it for scripting a program, but
later people started applying the term for languages like Perl or
Python, which are not scripting languages (in that original meaning) at
all. <snip>
[end of quote]

My experience has been that given enough libraries, Lua is quite good as a
primary implementation language.
Perhaps Roberto is saying that Perl,
Python, and the like are better in that role, so the best use of Lua is
for scripting, the purpose for which Lua was originally developed.
Not sure what kind of answers you were after, but here's a scripter's view whose mostlyh been coding for the fun of it:

I'm looking at this coming from Perl, and have only done some apps on my own that are a couple of kloc of code at most. As to why Perl, it let's me prototype ideas so much quicker than the lower level languages, and has libraries for stuff I find important. Briefly libraries are the thing in Perl: COM, off-line and on-line MIDI handling, GUi automation, building accessible WIn32::GUIs, text processing, and so on. So first and for most: CPAN, the PPM command-line. and a keep it simple yet convenient coding culture that's markedly different from your average Java package -- you don't have to read 10 pages of docs and understand heavy OOP abstractions to get started. As to what I've done, I think my biggest Perl project is gotta be a Win32::GUI based, fully keyboard usable MIDI drum machine for the blind and other keyboard users, since I got fed up with not being able to use any of the soft drum machines out there:

http://vtatila.kapsi.fi/beats_me.html

As for Perl features helping you write large programs that would be absent from Lua, I don't think there is anything major. Both can easily do OOP and name spaces that I tend to use. I like Perl's POD documentation format, however, as well as good conventions of where the packages and docs go automagically. It is much quicker for me to look up Perl docs compared to any other language due to perldoc and the neat dir structure.

Another thing I find helpful is that Perl's strictness is compile-time so my variable typos. and I do these a lot coding with speech, are caught much earlier apart from method calls. Would be great to have such support for Lua, as a special build, add-on Lintlike program or some such thing. Other than that I don't complain. I tend to view Lua as a kind of minimalist, orthogonal Perl with the Unixisms ripped out and a change in philosophy. most of the core mechanisms allowing you to do the Perlisms if you want to are there, and even more. Cloning Ruby's arrays and related mixins would be a fun coding exercise in Lua OOP, <grin>.

It might even be that because Lua givse you less syntax, you write programs that are cleaner for new programmers to understand. I miss autovivification, hash slices, map and grep, push, regexp lookaround etc... But this is just minor quibbling and redundant convenience. While code not using it might be a bit more wordy, it does not require you to understand those concepts, and might be easier to maintain. I find that because perl has all these mechanisms at the language rather than library level, I tend to use them where it makes sense, often optimizing for brevity or elegance as opposed to coding for maintainability. Lua allows you to stay maintainable as it has fewer temptations. Still, I am, maybe as a result of Perl, a big fan of programmer convenience still as in Ruby. I haven't done Python so cannot comment on it, though.

--
With kind regards Veli-Pekka Tätilä
Accessibility, Apps and Coding plus Synths and Music:
http://vtatila.kapsi.fi