3 ms·
>If you had read the code you wouldn't have such a high opinion of it! That's probably true of most code :P >Definitely arguable which way it should go and I
by hexane360 5y ago
>If you had read the code you wouldn't have such a high opinion of it!
That's probably true of most code :P
>Definitely arguable which way it should go and I think for clarity it's much better to use different names anyway. It's not because they don't understand anything.
I agree it's debatable which behavior is better. The reason I claim a lack of understanding is because of a comment (albeit likely a flippant one) one of the maintainers made in the issue I linked:
>When a variable or parameter has a declared (annotated) type, it's the job of a type checker to validate that all values assigned to that variable are compatible with the declared type. This is how type checking works in all languages that I'm familiar with.
This just isn't true; many strongly-typed languages allow variable shadowing, especially within lexical scopes. Some, like Rust, even allow rebinding within the same scope.