On 2/16/13 3:38 PM, Chris Peterson wrote:
Is this a feature or a bug? The Rust manual has no comment. This
behavior was surprising, but I actually it. I use a similar pattern in Python when transforming a variable to a different type. I don't want to make up a new (and uglier) name when I no longer care about referencing the old value.
I like this pattern a lot. In fact I often intentionally shadow variables if I want to make sure that they can't be used again (for example, if I'm moving the variable somewhere else, or I'm casting a numeric and want to make sure I never use the old value).
I believe it's a common functional programming idiom. At least I started using the pattern a lot when I got into OCaml.
Patrick _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
