lua-users home
lua-l archive

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

> I've always had the mind set that the "IF test THEN action END" 
> statements were not only chosen because they reduce compiling and
> parsing ambiguities, but also because they are clearer for new 
> programmers whats going on then a slightly more cryptic C like 
> syntax "IF (test) action"
> With the current syntax you can almost form statements that read
> much like an English sentence:
> if not exiting then
>     continue
> end
> Opposed to:
> if (!exiting)
>     continue;
> Certainly the C syntax has its advantages, less typing comes to mind,
> but isn't Lua supposed to be designed for non-programmers as well?

Personally speaking I agree with this sentiment. I dont think there should
be optional keywords. I think Lua is easy to scan read and not verbose. It
could be said that if you dont want to confuse beginners with this then dont
tell them about the feature, but then when you have things like standard
libraries you may get mixtures of coding style, which doesnt always lead to

It would be nice to be able to have single statements if conditionals, eg.
"if <condition> return|break" but since there is ambiguity we'll have to
make do with blocks. I dont remember many mails complaining about this. Its
just an unfortunate side effect of the optional ";". I just wonder if "then"
and "do" were made option if this would force other quirks further down the
line when people want to extend Luas syntax again.