16 ms·
Safety! Having "my_cat" and "myCat" as different variables in the same space sometimes ends up with using the wrong variable, especially when using tab completi
by federico3 11y ago
Safety! Having "my_cat" and "myCat" as different variables in the same space sometimes ends up with using the wrong variable, especially when using tab completion.
The feature is not meant to encourage developers to use "my_cat" and "myCat" randomly within the same file.
- msie 11y agoI don't like the idea of a language encouraging sloppy coding.
- federico3 11y agoThis is not different than having foo_bar and foo_Bar as two different variables.
- dragonwriter 11y agoWell, yes, it is. And its worse, especially when the variables aren't "foo_bar" and "foo_Bar", but, say, "cycle_often" and "cycle_of_ten".
- progman 11y ago> "cycle_often" and "cycle_of_ten". Such an error is caught by the compiler. const cycle_often = 10 var cycle_of_ten : float ambig.nim:2:5: Error: redefinition of 'cycle_of_ten'
- krupan 11y ago"The feature is not meant to encourage developers to use 'my_cat' and 'myCat' randomly within the same file." I'm sure it's not, but it isn't doing a thing to discourage that. We stopped using case insensitive file systems a long time ago, didn't we?
- federico3 11y ago...actually we didn't.
- dragonwriter 11y ago> We stopped using case insensitive file systems a long time ago, didn't we? Windows didn't. But even Windows doesn't use an underscore-insensitive file system.
- dkersten 11y agoI'd rather have them be different identifiers but with a compiler warning if they're found in the same file.
- dragonwriter 11y agoSafety might prohibit different identifiers with a certain degree of similarity, but it wouldn't treat different-but-similar identifiers as if they were the same. Treating them as the same creates more danger -- the danger that the programmer intended them to be different, but the language treated them the same -- rather than mitigating danger.
- rat87 11y agoSometimes the best name for a variable is a variation of the associated class/function name.