I agree that it's a problem with grep, there's a nimgrep tool that you could use instead, but I don't.
The nice part about it is that you can use a consitent naming convention even when using external libraries.
My idea to solve the problems this causes without removing it would be a gofmt like tool as described here: https://github.com/Araq/Nim/wiki/GSoC-2015-Ideas#nimfmt-auto...
That's the entire point of gofmt. Like many of Go's design choices, it's there to subtly (or not so subtly) encourage doing things in one consistent way.
If I ever design a language I might have to remember that.
I think a slightly nicer (in the sense that it would catch more typos) way to do it might be to specify the naming convention at the top of the source file, and have the compiler enforce that naming convention within the file.
Maybe also have a way to set it in the build system, so it could enforce it for the whole project. That way your project is consistent, but the libraries you rely on don't have to match your conventions.
http://nim-lang.org/0.11.0/manual.html#lexical-analysis-iden...
This just killed my excitement for this language. That's really surprising to me that they would choose to enforce indentation Python-style, but would then allow this kind ambiguity in naming.
grep and emacs isearch-forward are such great tools for quick code searching and this will break them. I guess text search (and replace) tools could grow nim-mode options, maybe. I don't know, can someone convince me this is a good idea?
That would be a pretty hard sell. Any convenience argument falls flat to me.
In my opinion it should be an error or at least a warning.
I'm not a big fan of nim's behaviour, but I don't think it's any worse than what other languages do.
Them being the same is worse. I agree that both are pretty darn bad, but it's also pretty clear to me which is worse.
That's the same as saying "`a` and `A` should be the same variable", i.e. complete case insensitivity.
> It's a pretty bad code smell either way.
Very much so. We shouldn't encourage it.
Having them be the same, by far.
Having names with certain similarity be prohibited in the same scope is a bit excessively controlling but sensible. Allowing them but treating them as equivalent is just plain bad. If I named them differently then either: (1) I made a mistake, or (2) I intended them to be different.
I use same names with different styles to denote scope. I will be hosed then.
If you're using Emacs to begin with... well there is little reason to complain about the default behaviour of functions and keybindings.
You also have to read others' code, as well...
The feature is not meant to encourage developers to use "my_cat" and "myCat" randomly within the same file.
And its worse, especially when the variables aren't "foo_bar" and "foo_Bar", but, say, "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'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?
Windows didn't.
But even Windows doesn't use an underscore-insensitive file system.
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.
Try having a variable signon and a variable signOn. Or two functions with the same type signature, one called signon() and one signOn() (for example, imported from two different modules).
Yes, let's generalize - reading the blog and the comments, this "case sensitivity ruins productivity"-problem seems to only be a problem in scripting languages.
I would see
use foo::signon;
use bar::signOn;
clearly, if I have to import this in my own file I should be VERY careful about those two functionsor rather, I'd import from foo, but I'd use the namespaced version from bar
so `signon` would be `foo::signon`, but `bar::signOn` would be written out fully to avoid this kind of clash
Here's how you declare a binding:
let signOn;
let signon;
I seriously hope you don't declare both of these in the same scopeTHIS_IS_A_CONSTANT SomeClass someVariable someMethod()