lua-users home
lua-l archive

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


throughout our code we frequently use the following construct:

foobar( function() ..... end )

where the anonymous function body is often very small.

Leaving cancer of the semicolon concerns aside, maybe this is just
begging some form of syntactic sugar, similar to

foobar "string" as an equivalent for foobar("string")
foobar { foo = "bar" } as an equivalent for foobar( { foo = "bar" } )

What would you suggest as a possible syntax? It has to be
implementable with token filters, and simple enough to fit with the
overall syntax of the language.

foobar function ... end ?

Why do we need the empty () in normal Lua anyway? I guess they are
needed to disambiguate in some situation, but I can't think of it...

Best regards,