[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Implicit Globals - A compile time solution.
- From: "Mark Meijer" <meijer78@...>
- Date: Wed, 20 Feb 2008 17:53:23 +0100
On 20/02/2008, Javier Guerra <email@example.com> wrote:
> On 2/20/08, David Given <firstname.lastname@example.org> 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