6 ms·
I agree that shadowing is bad. Implicitly scoping variables to their lexically-outermost point of use is a terrible solution, though: changing anything in any
by implicit 12y ago
I agree that shadowing is bad.
Implicitly scoping variables to their lexically-outermost point of use is a terrible solution, though: changing anything in any outer scope can completely change the meaning of code in all nested scopes. That's really really bad.
A much better syntax would is to require the 'var' keyword to denote the scope of every variable, but reject shadowed symbols at compile time.