The following code snippet does not emit any compilation warnings about 
redeclaring variable names or types:

    fn x(y: int) -> ~str {
        let y = y + 1;
        let x = y == 2;
        let x = x.to_str();
        x
    }

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.

chris
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to