lua-users home
lua-l archive

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


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.