Hacker News new | ask | show | jobs
by klibertp 4619 days ago
It's the same in Python, and it's mostly solved by external static code analysis tools. The trick here is the assumption that misspelled variable will be used only once in a file - exactly where it got misspelled - and tools like pylint or pyflakes warn about such names. If you're running these tools sufficiently often and have them integrated with your editor (my Emacs runs pyflakes once in 3 seconds, after enter is pressed and on save, whichever comes first) this kind of error is essentially eliminated.

OTOH, having a language which doesn't need external tooling to eliminate such errors is an obvious win. Smalltalk, with it's code browsers, refactoring tools and similar does this really well, for example - if you use a new name inside a method definition you are asked if you want to declare new instance or block variable, or turn it into selector, or if you want to rename it (and then it gets renamed throughout the method) and so on. And that's at compile time!