The creator of Ruby called local-by-default "the single biggest design flaw
in Ruby". http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/42266
Yes I have read that in the archive - I must say I was not able to fully understand the reason why they consider this such a big design flaw - I must admit I do not know Ruby - I guess that because of how Ruby is designed this may create a lot of problems (this is precisely what you mention at the end of your email)
All the problems you have with unintended or accidental bindings are more
severe with default local scoping. And fixing those issues in application
code becomes messier, both syntactically and semantically.
Can you make an example of why default local scoping would be worse? and why fixing would be messier?
This seems related to the problem of shadowing unintentionally - it seems to me that in both cases, explicit local or explicit nonlocal, the programmer must be aware of what is going on in inner scopes. If one forgets "local" it can break something globally in other functions; if one forgets "nonlocal" the damage will be limited to the function (and the enclosed functions).... or am I wrong?
variables. Lua is a functional languge that permits OOP with some syntactic
You are right! And I love that - the simplicity of Lua - and the fact that it provides mechanism - I really really love that.
Andrea