lua-users home
lua-l archive

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


Hi,

>From Lua's reference manual:

	"Lua is an extension programming language designed to support
general procedural programming with data description facilities. It also
offers good support for object-oriented programming, functional
programming, and data-driven programming. Lua is intended to be used as
a powerful, light-weight configuration language for any program that
needs one. Lua is implemented as a library, written in clean C (that is,
in the common subset of ANSI C and C++)."

The first thing I noticed is that Lua is being abused. Many of us use
Lua as an extension language to write many parts of applications, others
as *the* language to program entire applications with minimal C support.
Who could say that a configuration language would be used to control
NPCs and program their AI in many commercial games?

Of course Lua fits well in those scenarios and the manual should be
changed, but it clearly gives us a hint on how Lua evolved. Why a
configuration language would need:

. Threads?
. Coroutines?
. An incremental garbage colector?
. Packages?
. Dynamic binding?
. All those metamethods?
. OOP? :P

A good example of Lua changing because of specific users needs is the
incremental GC. It was required by real-time applications, because of
the pauses imposed by the GC.

Another good example is packages/dynamic binding. Does a language
targeted to configuration need to load and bind to native code? Of
course it sometimes needs to be extended, but as a configuration
language shouldn't we just statically bind native code and manually
register the functions that must be exposed? Packages move Lua towards
being a full-featured language like Python, one that isn't supposed (or
is very hard) to be embed but to write entire applications. Good that
Lua doesn't depend on and can used without any package.

Threads aren't needed by everyone, but they're there. The same is true
for coroutines, packages, the metamethods and even the very little
support to OOP via "self" and ":". Should we remove them?

Lua evolved because its users needed it to evolve. It was necessary to
evolve. Lua lacks proper OOP support, shouldn't it change to support it
if its users need it? Shouldn't it have a syntax to the most common OOP
constructs, probably with some more metamethods to help those who won't
be satisfied with the built-in implementation? For me the answer for
those questions are a loud "yes"!

Those who are against OOP, as I was once against packages, should take
some time to think if the features they use are needed by other users.
Having OOP doesn't mean you'll have to use it. C++ can be used to code
entire apps without having to declare just one class! With Java you have
to declare just one class that has the main method, and inside it you
code all static methods and pretend the class is just a kind of module.
I think the saying "If you don't want to do something, just don't" fits
nicely here.

Or maybe the authors decide that it must stay as a procedural/functional
language only.

Regards,

Andre de Leiradella