lua-users home
lua-l archive

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


To clarify and evolve,  Lua has two main intentions: 1) to serve as a
configuration language where creating globals by default is hard to argue
against and 2) as a scripting language where it is at least arguable that
writing to globals by default is not a desirable feature.

Now if we add the global keyword, the global("name", value) function, or the
:= assignment (which one is best is a good question) all of which do
assignment ONLY to globals.  Then people who want to write in a
anti-global-write sort of manner can execute global_write(false) (or
whatever it's called) and get the help they need/want.  Others can happily
continue writing in standard lua (as the configuration camp would always
want to do) with no change.

If these two pieces (the global only write mechanism and the global_write
switching function, the later could be written in Lua but would be nice to
have as part of the standard so we would have to find it or have different
versions of it) were part of Lua then those who didn't need them would only
have to deal with reading code that used the global-only-write mechanism
(which is a strong argument for making it obvious, := not being at all
obvious).

In this world both styles of coding happily coexist.  One can easily get
into a state that global_write is in the wrong state, but if the code that
uses the global write mechanism has *ever* been run with global_write(false)
then there's no problem.  That's my suggestion.

Russ