Re: for loops & other enhancements

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: for loops & other enhancements

Ilja V.Levinson
Hello,

>It's true that "for" loops are syntactic sugar, but then if you have
>"if" and "goto" so are "while" loops. Syntactic sugar has to be judged
>on whether it aids or hinders a human attempting to understand a
>program.

>On this basis, I don't like general "for" loops. However, I do like

Agreed...

In my opinion, the more useful enhancement to Lua in this
area would be anything like "C" break operator for exiting 
from middle of all loops. "C" like continue is useful too.

>I have also made some enhancements.  We needed to make sure all of
>the global variables were cleared out between calls to lua scripts,  so 
>I added lua_clearvar, which is a command that clears out all of the global
>variables (it adds the built in commands back in at the end):

The more general decision, I think, would be creating a "pure"
Lua engine. In that case the host program can create multiple
Lua instances (each with its own script running, own global variables
and so on), and can destroy the unneccessary instances.

Regards,
  Ilja
--
-----------------------------------------------------------------
    Ilja V.Levinson      | If fifty million people say a foolish
 Yekaterinburg, Russia   | thing, it is still a foolish thing.
  [hidden email]    |             **********
-----------------------------------------------------------------