Re: Are parenthesis-free calls a Good? (was Re: patch: C-style string lexing)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Are parenthesis-free calls a Good? (was Re: patch: C-style string lexing)
- From: "Alexander Gladysh" <agladysh@...>
- Date: 2008年1月31日 19:06:11 +0300
> 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.