I think we're all agreed that declaring the same var twice in the same scope is a mistake...
I certainly don't agree that it's necessarily a mistake, even in the case that Dave Mitchell demonstrated, where the compile-time lexical binding may differ across closures. You can't analyze that statically and get the right answer all of the time!
Separate the act of assignment from the act of declaration and think about the code again.
Then separate the judgment of "Would I write code this way?" from "This is a practice so worth discouraging that it needs special casing in the compilation process."
except for all the other languages that consider double-declaration like this a fatal flaw
Pure functional languages consider mutable variables a fatal flaw. I don't see how that matters either.
In reply to Re^7: Help! My variables are jumping off a cliff!
by chromatic
in thread Help! My variables are jumping off a cliff!
by oko1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |