lua-users home
lua-l archive

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

On 20/02/2008, Javier Guerra <> wrote:
> On 2/20/08, David Given <> wrote:
> >  I simply cannot see any clean way around this. As soon as you start
> >  using locals-by-default you end up in a horrible maze of special cases
> >  and inconsistencies.
> i guess that's what limits Python to have not-really-lexical scoping,
> with several special cases and confusing closures.
> i too dislike the global-by-default solution, but if that's the price
> for getting easy-to-use closures, then i won't complain!

It seems to me that the main argument for local-by-default, is to
prevent accidents with the global environment, and secondly to make
declaring locals optional, thus having to type less. Personally, I
think making declarations optional is a bad idea, both for locals and
for globals. To force explicit declarations for globals, as well as to
prevent accidents with the global environment, I use require 'strict'.
Maybe it's possible to do something equivalent (or better) at compile
time. But my point is, perhaps one should ask oneself, whether one
really wants/needs local-by-default, or just explicit globals