lua-users home
lua-l archive

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




On Wed, Jun 5, 2019 at 9:30 AM Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
On Wed, 5 Jun 2019 at 15:08, Matthew Wild <mwild1@gmail.com> wrote:
>
> On Wed, 5 Jun 2019 at 12:53, szbnwer@gmail.com <szbnwer@gmail.com> wrote:
> > Ryan Ford:
> > >  I'm sure this would break the current syntax though as you would be initializing the local "resource" and assigning a new value to the global "x"
> >
> > if `resource` is a keyword, then it wont mess with anything, and no
> > new stuff will be usable in older versions, no matter what.
>
> As the maintainer of a >50k-line Lua codebase that extensively uses
> local variables named "resource", I beg to differ with the "it won't
> mess with anything" assertion.
>

Hi as I already explained in a previous post, there is no need for a
new keyword.
The parsing of:

local <resource> x
local resource x

are the same - both utilize the fact that after local a variable name
is expected, so anything in between can be easily parsed especially if
they are just identifiers.
Hence the markers are superfluous - at least for the proposed extensions.

Regards

It's not a problem when the proposed extension is around, but it does introduce inconsistencies with past versions of Lua, and there's still one grammatical ambiguity.

local resource
x = 3

Am I declaring a resource named x with the value of 3, or am I declaring a variable named resource with no initial value, and then setting an existing variable named x to 3?

Having some sort of signifier also greatly reduces the complexity of parsers and preprocessors, so I strongly oppose doing this without any sort of syntactic indication. I prefer @ over <> but there needs to be SOMETHING.

/s/ Adam