[q2x] OT: Lua questions

Nick Trout nicktrout at shaw.ca
Fri Jan 30 02:58:36 EST 2004


>> Well, it *is* a dynamically typed language.  I imagine you'd have
>> the same problem with plenty of other scripting languages.
> Yes, but in all fairness, you can be dynamically typed but still have
basic warnings.

It's true Lua could have a few more warnings here and there. Its pretty good
though.

>> It's not really something I've run into enough to annoy me.  It's
> certainly a downside of dynamic typing, but in my experience these
> runtime errors are just about as annoying as compile errors are
> with C.

>They are WAY more annoying, because they're caught much later in the
development cycle.  Having something barf after a few minutes of
run-time is way more disruptive (and dangerous) than something that
barfs before you startup.

It's an unfortunate side effect of dynamic languages, but does mean you can
do more with the objects at runtime and I find productivity much higher
using dynamic languages, because you have to write less code and its more
intuitive to write. You do curse a little hitting your thumb with the hammer
when you're building your framework. But, once its built you can refactor it
into something else much quicker with a dynamic language than a static one.
Prototyping is quicker.

Another unfortunate side effect, and you also get this with dynamic linking
in static languages, is catching extra bloat in your code when you want to
be tight with memory. It's difficult to do static analysis on code to
determine what is necessary.

I haven't used C# but I believe this is some halfway house, as may be Obj-C.
I think C# is some hybrid of Java and Python, i.e. Java with lists and
dictionaries as basic types.So I suppose you can typecheck optional parts of
your code and use variants in other parts? Suppose I ought to take a look at
this but I'm very happy with Python. I still think Lua has a little way to
go with certain features until it becomes a more mature scripting language.

I really dont miss type checking in Python though, and you can always use
its reflexive abilities to typecheck at runtime if necessary, but this
doesn't cure your complaint. Its possible the leap from static programming
to dynamic programming is as great as the one from functional programming to
OO. You just have to be able to read code and spot bugs more readily. Unit
testing is very easy in modular dynamic languages and this may help you too.

Nick





More information about the q2x mailing list