3 ms·
I disagree. Shadowing can be very useful when transforming types that represent the same thing. For example, rebinding a variable to be immutable.
by whyever 8y ago
I disagree. Shadowing can be very useful when transforming types that represent the same thing. For example, rebinding a variable to be immutable.
- swsieber 8y agoAnother one is traversing enums in Rust: https://docs.rs/syn/0.15/syn/enum.Expr.html#syntax-tree-enums https://docs.rs/syn/0.15/syn/enum.Expr.html#syntax-tree-enum...
- Animats 8y agoThose are examples of why shadowing is bad. Too-cute use of a risky feature. When looking for usage of a variable by search, it's helpful that there not be shadowing. Cuteness means trouble for maintenance programmers.