[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Locals by default yet again, sorry :)
- From: Pedro Tammela <pctammela@...>
- Date: Tue, 30 Jul 2019 10:47:06 -0300
So we have quite a large Lua + Luabind code base and new comers from other
languages often tend to forget the word *local *when declaring local
variables in a block/scope. Of course the Lua static analyzer flags such
code and we fix it, but sometimes such code still slips through basically
because this particular warning is not an error at the moment.
What I am wondering is, apart from using the static analyzer to catch it,
is there any code patch that can make variable declarations local by
Or is it too core to the language that changing this could cause issues
elsewhere? I am willing to sacrifice performance as we are on PC and its
worth doing this for us to prevent erroneous code if it can be done without
requiring significant change to syntax.
I had a look at http://lua-users.org/wiki/LocalByDefault but there does not
yet seem to be any solutions for Lua 5.3 for doing this globally in the
could be of interest.