lua-users home
lua-l archive

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


> On May 14, 2020, at 6:24 PM, Sean Conner <sean@conman.org> wrote:
> 
> So why not use '_ENV.' in place of 'global'?  It's already supported by
> Lua, and it makes it *very* easy to locate the use of global variables.

The useful part of the feature is that simply typing ‘x = 1’ is an error. Using _ENV only benefits readers. Being forced into deciding whether to use global or local and where, is useful for writing (or at least, it forces a change in the process of writing). Programming language design is as much about what are invalid programs as it is about what are valid ones.
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org