> Globals do not necessarily impede modularization and encapsulation
Of course they do, by definition! Code that stores it's state outside
itself, where anybody can stomp on it, is NOT encapsulated.
[snip]
Prototype objects, classes, system functions, and any other "well known" entities are usually good candidates for globals. Just because something can be referred to globally doesn't mean that you've broken encapsulation. You can't prevent a bad programmer from breaking encapsulation, especially if you language is easily extended in something like C (as lua is).
See: "Global Variables Considered Harmful", Wulf and Shaw, 1973.
Reasoning along the lines of "you shouldn't use tool X because tool X can be misused" is no different from reasoning "you shouldn't use a knife because knives can used to stab people". Globals, like most tools, in skilled hands, can produce elegant software that is easily tested.
Dave
--