lua-users home
lua-l archive

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


Alexander Gladysh wrote:

> I personally often use such calls in my micro-DSLs. Like this:
> foo "name"
> {
>   bar "bar";
>   baz "baz";
> }

But could other implementations be clear without using parenthesis-free
calls?

I have to admit that the code above is easier for a non programmer to
understand than a verbatim modification to parenthesis-free calls:

foo("name")(
{
  bar("bar")
  baz("baz")
})

But I bet the error messages are completely unintelligible! I guess a
user would just compare against a known good example until all it works.

I've recently had the displeasure of looking through a 4k-line custom
DSL config file in order to debug a very cryptic error message. I said
to a colleague, "Too bad it's not in Lua." Then I realized it could be a
domain-specific language using Lua! In this particular case I doubt it.
The problem ended up having nothing whatsoever to do with the DSL or
config file contents.

I have been able to use configuration files successfully using
parentheses. I typically put the items directly in a table then call a
registration function if necessary. I doubt that my problem spaces
(embedded or scientific) are typical, though. I don't mind the
parentheses so much since they don't really pile up to the extent that
they do in Schlisp.

All abstractions hide complexity, so in some sense my wishes are nothing
more than a preference about where to draw the abstraction/transparency
line. My only supporting arguments are those I mentioned initially and
the fact that simplicity has served Lua so well in the past.

>From your message posted while I composed this:
> If they made that a syntax error and added constant folding to
> strings we'd probably both be happy? =)

Perhaps! Actually, I'm very happy with Lua as it is. Ask those around me
who groan every time I say the word "Lua."

As Roberto says, there's no need to worry. Any changes to the language
will bend around this syntax - it is truly part of the ancient soul of Lua.

Doug

-- 
Innovative Concepts, Inc. www.innocon.com 703-893-2007 x220