Re:Nim Programming Language 0.11.0 released
by krupan on Thursday April 30, 2015 @03:02PM
(#9466973)
"Which is worse: them being the same variable or different variables?"
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.
Re:Nim Programming Language 0.11.0 released
by dragonwriter on Thursday April 30, 2015 @05:47PM
(#9467871)
> Suppose you have MyVariable and my_variable in your code. Which is worse: them being the same variable or different variables?
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.
Re:Nim Programming Language 0.11.0 released
by wtetzner on Thursday April 30, 2015 @02:42PM
(#9466862)
Yeah, I think it would make more sense to treat them as the same, but throw an error if they are spelled differently.
> Suppose you have MyVariable and my_variable in your code. Which is worse: them being the same variable or different variables?
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.
Re:Nim Programming Language 0.11.0 released
by reddit_clone on Thursday April 30, 2015 @09:53PM
(#9468922)
Huh? This is terrible.
I use same names with different styles to denote scope. I will be hosed then.
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.