lua-users home
lua-l archive

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


Philip Plumlee wrote:

> My pet theory is that static typing is good for low-level code, and
> dynamic typing good for high-level code.
> 

That's kind of self forfilling. I think the best solution is a language
which offers both. It's pains me to say it but I think languages like C#
are a step in the right direction, although I don't think C# is really
dynamic, or high level, it just has more introspection, GC etc over
things like C++. I much prefer programming in Python to looking at C# as
it's so productive. You don't (I think) have mapping types and lists etc
in C# which are nearly as flexible as languages like Lua, Python, Perl
etc.

I'd like to see Lua add some static language functionality as Lua is
highly dynamic and configurable, certainly more "easily" so than Python.
It would be nice to have more optional compile time information about
scripts and support for "static" constructs. A small Lua script can
generate a lot of runtime dynamic allocation. I wouldn't be at all
surprised if this was the reason for Bioware avoiding Lua, especially if
you have several thousand lines of code. -- Lua is still better than a
lot of languages (e.g. Java) but still extra data is generated.

Examples: 
 * When you register a function you pass a string and C pointer. The
string is duplicated and hashed and the function pointer wrapped in a
closure. Fine. But if you have several hundred of these they add up. (I
described a method of getting round this using a dispatch system a
couple of months ago).

 * When you have a local table in a function this is generated from VM
commands and them garbage collected. It would be nice to have "static
const" tables which didn't have to be generated and were read like
locals are.


Nick