lua-users home
lua-l archive

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


Curt Carpenter asks:

> What's wrong with saying that all function invocations must use the
> parenthetical arg list syntax?

Nothing if you like typing parentheses. Nobody is forcing you to leave 
them out. However, the syntax:

  foo({12, 45, a = "Hello"})

is ugly. It's nice that you don't have to use it, I think.

No ambiguity would be created by allowing:

  print 5

I don't know why it is not allowed. However, allowing in most positions, 
you could not use variables or general expressions; this would be 
ambiguous.

The above statement is not true in a call statement. Parentheses could be 
unambiguously removed from a call statement, subject to the current 
parenthesis disambiguation rule. This is probably not a good idea, though, 
even though I seem to always find myself typing

*  print x, y