lua-users home
lua-l archive

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


Javier Guerra wrote:
> On Tuesday 03 October 2006 9:49 am, David Olofson wrote:
>> I wasn't really aware of this issue at first (haven't designed all
>> that many languages before), and of course, got it wrong in EEL
>> (local by default), did some scripting, realized it was just plain
>> stupid, switched to explicit declarations for everything, and never
>> looked back.
> 
> i've read (and agree with) the long and theoretical explanations about why 
> local by default is the wrong choice; but could you share any short anecdote 
> that convinced you of this?
> 
> my point is that a short and simple example might be more convincing than 
> the 'real' reasons (and easier to repeat again and again each time this issue 
> is mentioned...)

A little searching of the list would avoid rehashing this every year.
Mike Pall summed things up well in August 2005 [1].

If you read the Python PEP "Statically Nested Scopes" [2] carefully,
you'll find that lexical scoping in Python does not allow rebinding of
outer variables, exactly because of variables being local by default.

[1] http://lua-users.org/lists/lua-l/2005-08/msg00139.html
[2] http://www.python.org/dev/peps/pep-0227/