lua-users home
lua-l archive

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

> "Nick Trout" <> wrote:
> > What about Python? Its simpler and more powerful than Lua.
> How is Python simpler or more powerfull?

The language design is cleaner and simpler I think. For instance, this argument
about global values being a global table and not a special case already exists
in Python eg. dir(__builtins__) gives you all global methods and exceptions. The
source is also very easy to follow although there is less Lua code! I'm not
trying to deride Lua. Every language has its strengths and you want to use the
best/most practical tool for the job. Lua is easier to embed as you dont have to
mess around with reference counting, very simple interface. Some applications
benefit from Lua being used as its scripting language and some benefit from
Python being used, obviously depends on you needs (application size, memory
available, ease of customisation, speed of script execution, language features,
script supported tookits and libraries etc). Lua is gradually evolving into
being a practical programming language whereas before its goal was just to
provide an easy mechanism to configure your application. Please correct me if I
am wrong. Therefore the language has certain nuances (eg. this global table
problem) whereas Python was created with the intention of being a pragmatic
scripting language. eg. its more OO (list and dictionaries accept methods) and
its syntax is less "bodged" eg. "for" keyword instead of a function in Lua.
Python classes support inheritance. I know a lot of the functionality is
duplicated and Lua itself admits to being a meta language which for me makes it
slightly more complicated ie. less readable/simple! Python is more powerful IMO
for being more OO.

> > It has proper classes and no confusing upvalues or tags.
> That does make it easier to get started but Python classes are very limiting
> compared to prototypes in Lua. You can also easily implement Python-like
> classes in Lua. upvalues and tags are confusing, but aren't things most Lua
> developers should ever have to use after setting up their object system.

I agree with this. Can you do inheritance with Lua? Copy an inherited
class/table into the inherited class table?

> > It would be really nice if there was a version of Lua that you could just
> give
> > some memory (including the state info) and all allocation was done through
> this
> > and all code was generated in this. You could serialise a whole frozen Lua
> > state? Great for memory limited systems (and you could monitor illegal
> memory
> > access more easily). Maybe it exists already and I havent read the docs!
> That would be very cool. LISP and Smalltalk have that ability. There are
> portablility issues for using the same frozen state on a different platform
> though.

I think this would be a great feature. Good for embedded systems and "threads"
(in games!). Suppose you could use some kind of compression as well for
serialisation. Would be especially good now Lua is properly reentrant (I think I
read that on here).