by eurleif · 13y ago · 0 comments
If you want to have var with the same name as something in an outer scope, there are ways to do it, specifically an IIFE.
Here's an article for you: https://github.com/raganwald/homoiconic/blob/master/2012/09/...
Enforcing best practices by throwing errors where other languages wouldn't (like Go does) is one thing. Enforcing them by introducing difficult-to-track bugs into code that happens to be in the same file as other code which uses bad practices is another. This is a bug, not a feature.
My point is that as unfortunate quirks go, this one isn't actually that big of a problem in practice, especially if you know to watch out for it and take simple steps to protect yourself from it.