Re: scope of variables
- Posted by mattlewis (admin) Dec 31, 2010
- 2762 views
Why do you want to change a rule that is accepted in all languages: >>One can redeclare a variable inside a function and shadow an outer one.<<
There is nothing wrong with that rule. If you do that, one will have to constantly use name space qualifier, horrible!
It's better to leave it as it is now than make things even worse.
This!
My take is that we should probably allow the new, smaller scopes to have variables shadowed, as it makes scopes more consistent (i.e., some scopes would no longer be more equal than others).
There is zero probability, I think, for removing any shadowing by routine level vars of file level symbols. Using a configuration option (with/without) is slightly less bad, but an awful idea, I think. It would make coding more difficult to need to check / set this option.
Matt