|
Hello,
In the second incarnation of this battle I came in swinging for the "locals-by-default" corps and was quickly converted to the other camp with this single missive:http://lua-users.org/lists/lua-l/2005-08/msg00139.html
Thank you very much. This is exactly my question and the answer and I needed :
... Proper lexical scoping really requires that you have a choice between mutating a binding (assignment) and creating a new binding (declaration). Alas, the 'local by default' rule mixes them and makes an assignment do both. Consequently you cannot modify a variable in an outer scope with a simple assignment (because that would create a new local variable with the same name). ...
This closes the question and this thread for me. Thanks again for this pointer.(I wish it really be put in evidence in some FAQ and certainly in Second Edition of the Book).
-- Olivier Mascia