lua-users home
lua-l archive

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


Of all possibilities I can think of (and without introducing new reserved words or ambiguities with other symbols), I would go with:

local @const x = 5

I believe @ is unused otherwise, can be thought as AT implying 'ATtribute', or even as a 'decorator' (for Pythonians) in the broader sense.

It's certainly a lot less ugly in my eyes than HTML looking < > brackets.

My €0.01

-----Original Message----- From: Dibyendu Majumdar
Sent: Monday, June 03, 2019 8:54 PM
To: Lua mailing list
Subject: Re: Syntactical ugliness - does it matter?

On Mon, 3 Jun 2019 at 12:13, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:

> local const x = 5
> local toclose f = ...

The only way to make this work is to add reserved words.
Otherwise, these already have a meaning in Lua. They are equivalent to

local const ; x = 5
local toclose ; f = ...


Hi Luiz,

Actually I think these can be parsed unambiguously for the same reason
that the current syntax can be parsed.

That is to say, there is no _material_ difference between:

local <toclose> f
local toclose f

In your example above:
local const
local toclose

Will be interpreted as declaring a local variables named const and toclose.
I hope you agree that the markers <> or * are superfluous in the
proposed use cases.
They only make a difference if a more complex extension was to be
introduced but without seeing examples of what these might be it is
hard to comment on the future viability of these markers. We can
however say that these markers are not unambiguous in expressions and
therefore if they are adopted then the extension mechanism cannot be
used in expressions.

Thanks and Regards
Dibyendu