lua-users home
lua-l archive

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


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