lua-users home
lua-l archive

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


> But I dislike the omitted parentheses in function calls. It seems like
> an unnecessary extension of Lua's beautiful tiny grammar, an exception
> that brings minor advantage but carries with it hidden disadvantages.
> Among these are a deterrent to other language modifications and the
> less-than-obvious-without-the-BNF 'f "A" .. "B"' is 'f("A") .. "B"'.

I personally often use such calls in my micro-DSLs. Like this:

foo "name"
{
  bar "bar";
  baz "baz";
}

I find this style to be shorter and to better express
"declarativeness" of the code.
Also it is arguable simpler for non-programmers to comprehend in some cases.

"Non-weird" equivalent would have too many braces to my taste:

local tmp = foo("name")
tmp({bar("bar1"); baz("baz")})

I believe Lua would be a bit less elegant without parenthesis-free calls.

Alexander.