[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: explicit mode
- From: Nagaev Boris <bnagaev@...>
- Date: Thu, 12 May 2016 19:51:05 +0000
On Wed, May 11, 2016 at 9:26 AM, Viacheslav Usov <via.usov@gmail.com> wrote:
> On Tue, May 10, 2016 at 7:00 PM, Sean Conner <sean@conman.org> wrote:
>
>>
>> I think he wants something like:
>>
>> global x -- define a global x
>> function foo(a,b)
>> local c -- define a local variable
>> c = a * b + y -- compile time error---y not defined
>> end
>
>
> I am not exactly sure. The more I think about it, the more convinced I am
> that, in principle, it is enough for the explicit mode to remove the current
> syntactic sugar that converts anything not defined as a local into a global
> table lookup. This will eliminate the silent promotion of mistyped locals
> into globals, and the need to type the ugly _ENV will always be a reminder
> for users that globals are not exactly cheap.
>
> But I am not going to insist on that.
>
> Cheers,
> V.
>
Hi,
you can use luacheck as a library and filter warnings to keep only
warnings about global variables. For example, you don't want "unused
variable" warning, but want only "using global" warnings - it is easy
to implement.
By the way, without any globals, how can one use normal globals like
"print", "math" etc? Always declaring them is annoying.
--
Best regards,
Boris Nagaev
- References:
- explicit mode, Viacheslav Usov
- Re: explicit mode, Luiz Henrique de Figueiredo
- Re: explicit mode, Viacheslav Usov
- Re: explicit mode, Chris Berardi
- Re: explicit mode, Viacheslav Usov
- Re: explicit mode, Michal Kottman
- Re: explicit mode, Viacheslav Usov
- Re: explicit mode, Soni L.
- Re: explicit mode, Sean Conner
- Re: explicit mode, Viacheslav Usov