lua-users home
lua-l archive

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


William Willing makes a good point about my proposal - you really do not want to have to put "_G." in front of every access to global functions (or library tables). Let me modify the proposal as follows:

In order to *create* a global variable (including functions and tables) you'd have to use "_G." syntax, but there would be an implicit and automatic "using" on all entries in the global table so you could *access* (or call) them without the prefix. In order to preserve the "first class" nature of functions in Lua, this has to apply to all variables in the global table which dilutes the benefit a little since it re-introduces reference ambiguity (which "using" as originally proposed would also do anyway).

However the proposal would still deliver the main benefits, without the problem William rightly raises.