lua-users home
lua-l archive

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


On Wed, Apr 24, 2013 at 11:18:19PM +0200, Dirk Laurie wrote:
> > Because Lua supports proper lexical scoping and nested closures so
> > thoroughly (as opposed to, e.g., Python), default local would be untenable.
> > The most sensible and simplest rule is what Lua uses, IMO.
> 
> I use a simple metatable modification to catch assignments to global
> variables whose names match a certain pattern, currently "^%a%d?$".
> I.e. names like `i` or `a1` will trigger a warning. Not foolproof of
> course, but I try to follow the rule that anything I genuinely want
> in `global` must have a nume that does not math that format.

My opinion became weaker after reading that thread last week. From a
language purity standpoint, though, different read and write semantics seems
wrong. But as a library or framework option, definitely cool.