lua-users home
lua-l archive

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


My 2 cent:

> I just happen to think if - then - end has a great redundancy.
> if {} is much more conchise.

Most of the time I have no problem with if-then-end.  The only
place it bothers me is in cases like this:

  if x then return x end
  if not x then break end
  ...

IMHO, the additional tokens "then" and "end" only obfuscate the real
meaning of the statements.  I would prefer:

  if x return x
  if not x break
  ...

that is: without a "then" only a single statement is taken and an
"else" is not allowed (same could be done with for, while, ...).

I would have already submitted a PowerPatch but unfortunately, this
syntax does not work because of the optional argument of "return"
which requires a terminating token (end, else, elseif, until, semi-
colon, or EOF).  Without one, "return" is ambigious:

  if x return
  foo()

could be:

  if x then return foo() end

And I don't like the idea to make i.e. a semicolon a requirement in
this case.

So, unless someone has a clever idea for that I guess I'll stick with
the current syntax.

Ciao, ET.