Re:John Carmack on Mutable Variables
by nayuki on Friday October 31, 2025 @09:37PM
(#45778564)
In Rust, one way I use shadowing is to gather a bunch of examples into one function, but you can copy and paste any single example and it would work.
In other languages that don't allow shadowing (e.g. C, Java), the first example would declare the variable and be syntactically correct to copy out, but the subsequent examples would cause a syntax error when copied out.
[ Parent
| on HN ]
There are no comments on this comment yet.