I quite like the feature and find it particularly useful for using similar variables for different, but related tasks (different in that it warrants another initialization, but similar in that it is beneficial to keep the same variable name). I don't feel too strongly either way though.

|// Without (explicit scoping)
fn  foo()
{
    {
        let  x = &something;
        ...do_with_x...
    }
    {
        let  x = &something_else;
        ...do_else_with_x...
    }
}

// With (redeclared local vars)
fn  foo()
{
    let  x = &something;
    ...do_with_x...

    let  x = &something_else;
    ...do_else_with_x...
}|

J

On 05/30/2013 09:09 PM, Robert O'Callahan wrote:

FWIW shadowed local variable declarations have been a source of some frustrating bugs in Gecko. In a big function you see a use of 'x', and a declaration of 'x', and assume they're related, but they're not.

Rob
--
q"qIqfq qyqoquq qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qyqoquq,q qwqhqaqtq qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq qsqiqnqnqeqrqsq qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qtqhqeqmq.q qAqnqdq qiqfq qyqoquq qdqoq qgqoqoqdq qtqoq qtqhqoqsqeq qwqhqoq qaqrqeq qgqoqoqdq qtqoq qyqoquq,q qwqhqaqtq qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq qsqiqnqnqeqrqsq qdqoq qtqhqaqtq.q"


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

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

Reply via email to