[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: The World According to Lua: How To?
- From: "Ashwin Hirschi" <deery@...>
- Date: Sat, 19 Feb 2005 04:23:03 +0100
On Sat, 19 Feb 2005 02:07:39 +0000, David Given <email@example.com> wrote:
I use Lua as a scripting language, to knock up simple throwaway programs
quickly. The two most complex programs I've written in it are a Makefile
generator --- which works very nicely --- and a C++ preprocessor that expands
special syntax for our platform. Both of these highlighted Lua's problems as
an application programming language; basically, it's not scalable. It's very,
very good at writing *small* pieces of code and very, very bad at writing
*large* pieces of code. You can get around this with discipline, but frankly
if I was writing a large application I'd use something else --- Ruby,
Interesting thoughts & observations, though I'd have to say that my experiences are *completely* different:
Yes, I use Lua to create little commandline tools to perform simple tasks, like downloading and tracking data from websites. But, at the other end of the spectrum, we've also used Lua for large (commercial) projects, involving client-server architectures and such.
At the moment I'm busy creating a fairly compact mailer module as part of an interview panel-management system (for a research firm client). While at the same time we've started work on a mid-sized webapplication that will allow people to navigate employment statistics for the educational sector (a government contract).
I'm bringing these projects up, because they vary in size from small to medium to fairly large. They're all being (or: have been) developed in Lua. And, believe me, Lua is more than up to the task.
You're probably right in that discipline helps. But, quite frankly, I don't consider myself to be a very disciplined guy [and most of my friends and colleagues would probably agree... :-)].
Then again, after a dozen years of professional development in C++, anything that doesn't make me feel like I'm navigating a minefield while coding comes as a relief. I guess it's all a matter of personal perspectives.
Lua's biggest problem when writing large applications is the hoary old
chestnut of misspelt global variables. It's *amazingly* painful not to be
warned if you misspell a variable name... your program just doesn't work,
sometimes in strange ways. A lesser problem is the fact that variables are
global unless specified local, which is the opposite to most other languages.
The global-vs-local point is a good one. Coming from other scripting languages where the "local" behaviour is default, I would love to see Lua adopt a similar attitude. It's been discussed on the list before, and it seems the powers-that-be think the advantages don't outweigh the downsides. Alas...
Having said that, I should state that the default-to-global thing hasn't nearly been as much of a problem as I thought it would be [here I go shooting myself in the foot...]. Thinking about it, I'm not quite sure why this is... Perhaps the way I'm developing stuff with Lua is what makes the difference here:
While statically typed systems have you coding fairly large stretches of code before even running them through the compiler [let alone link, build, run & test it...], Lua's dynamic nature enables you to edit and run your new code almost immediately.
Basically you skip all the pointless waiting and blindly staring at your IDE bit, and simply save, run, and see the difference your code changes make. This way any coding stupidity on my behalf usually gets caught in a very early stage, saving me lots of embarrassment later on [yay! ;-)].
Also, I find developing software this way a very satifying experience, somewhat akin to noodling with Smalltalk and Forth (way back in the *cough* eighties).
Lua definitely works for me.
no signature is a signature.