lua-users home
lua-l archive

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

On Wed, 2023-03-01 at 23:43 +0000, Paul Ducklin wrote:
> I have very often given thanks for the trailing comma in table
> initialisers but have never wanted, let alone needed, to write
> f(a,b,).
> I have never felt like writing f 2 instead of f(2), either,
> given the ubiquity of the notation f(), for which f{} or f””
> or f[[]] are at least reasonable lexical substitutions.

Agreed when you consider it from a programmer's perspective.
Those who write software should be able to grasp concepts that
are involved above, and use the language properly, for their own
good, benefit, sanity, etc.

But there is one use case that applies even more to Lua than
other languages: config files. There are applications which use
Lua as their language for data, as well as for configuration.
And the user who creates this file may not even be aware that
he's using a programming language, or is "programming a sequence
of instructions", when the action is perceived as "providing a
few config items". That's the very context where absence of
semicolon, support for 'key "value"', and especially braces are
very useful. Little languages as they are referred to. And IIUC
this is Lua's very origin before (in users' perception) it turned
into a programming language.

But apart from that: I can see how braces and brackets naturally
form delimiters that are rather straight forward to detect.
Quotes may not as much, but could be if you strictly start from
left and work to the right. But optional semicolon, end-of-line
not meaning much, _and_ parentheses becoming optional for
arbitrary complex expressions -- that's a bit too much. The
syntax already is ambiguous (for historical reasons).

virtually yours
Gerhard Sittig
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.