3 ms·
Sure, it's a misfeature, IMO, but it's certainly not a reason to write off the language. No matter what language you use, if you have two variables named myVar
by bryanlarsen 11y ago
Sure, it's a misfeature, IMO, but it's certainly not a reason to write off the language.
No matter what language you use, if you have two variables named myVariable and my_variable in the same scope, you've created a huge land mine in your code, and your linter should complain. Eventually somebody's going to come along and mix the two up.
The fact that nim blows up differently than every other language just makes it more obvious that this is something you just shouldn't do.
- gjm11 11y agoYup, having myVariable and my_variable is asking for trouble in any language, and what bothers me about Nim is not at all that it makes that harder. What bothers me about Nim is that (1) it makes it easier for you to call the same variable myVariable in some places and my_variable in others because that won't make compilation fail; (2) once that happens it becomes harder to find references to that variable, because the usual searching tools will miss some of them (and you will not necessarily get any indication that you've missed any); and (3) there are -- hopefully rare, I concede -- cases where what in another language would be obviously and innocuously different identifiers collide. nOpenFiles versus no_pen_files. use_rsync versus user_sync. And what does this buy you? What is the advantage it confers? That you have the flexibility to call the same thing myVariable in some parts of your code and my_variable in others. But that's a terrible idea and making it possible is not a feature.
- greydius 11y ago> if you have two variables named myVariable and my_variable in the same scope But that's not the situation in the example. user_sort and use_RSort are perfectly fine identifiers that no reasonable person would expect to be interpreted as the same.
- progman 11y agoSuch a conflict can be resolved easily by qualification (a.user_sort and b.use_RSort). What's the problem?