lua-users home
lua-l archive

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

Hi guys,

A friend of mine recently looked into Lua, and had some concerns with
the way it is.  I've listed his points here (each line prefixed with **)
and my proposed reply.  I claim not to be a Lua guru, so I'm asking for
some advice on my answers. :)

* Coroutines miss the point.
* coroutine.yield(...) should just be shorthand for
* coroutine.resume(coroutine_that_resumed_me, ...)
  That they may, but they're still functionally useful.  I'm sure if you
  raised the issue with them, they'd add the functionality you'd like.

* There's no integer type.
  Not a problem.  If you'd prefer the "number" type to be an integer, it's
  just one #define while building it.  Also, a double can represent more
  integer values exactly than an int anyway.  See: for a discussion.

* The specification isn't nearly rigorous enough. 
  This isn't a problem with the language, but with its documentation.  If
  you include the source code (which is small and easy to read) then most
  of these problems go away.  Also remember that Lua is in part designed
  to be *changed* to fit your application.

* The whole argument passing mechanism is incredibly grungy, when they 
* already have a much nicer mechanism staring them in the face - tables. 
  This depends on your point of view.  You can use tables for passing
  paramters if you wish (ie, wibble{parm1, parm2, parm3=value3} etc).
* The modularity is very weak (no ability to protect any aspect of
* anything, everyone has the freedom to place anything in any 'namespace' 
* [i.e. a.b.c kind of place]). 
  Simply untrue.  Metatables allow you to protect pretty much anything.
* Very quirky string literals mechanism, with missing features.
  Very subjective.  I've never really found a missing feature that wasn't
  easily and nicely covered by some other feature.

* No hex constants.
  Not an issue.  You can use hex values in your source, although not
  constant.  Performance isn't the main aim of Lua, so it's no problem.
  I'm sure you could tweak the parser to accept them anyway.

* Semicolons essential sometimes but not always. 
  The need for what is normally treated as meaningless in some cases
  to make them unambigious is not unique to Lua.  (C++ suffers from
  this, too).  And you can always insert a newline and make your
  code more readable anyway.

* The whole syntax looks a little fragile, in terms of giving unexpected
* results rather than errors, if you get things wrong. 
  This is a personal source code style.  I don't find it fragile at all.
  The only slight issue is that it leaves the type checking to the
  function being called.  I personally find this makes everything much
  more flexible.
* No modulus operator.
  Not a problem.  There's a library function to do it.

* Undefined division-by-zero behaviour. 
  I'm not so sure on this one - 1/0 returns inf.  I seem to have bells
  ringing in my head about making division-by-zero behavior consistant
  is unportable.

* If there's a way to remove elements from tables, I missed it.
  You did.  table.remove()

Rob Kendrick, Pepperfish Limited         
PGP signed or encrypted mail welcome                         Key ID: 3651D17A