On 5/25/12 10:16 AM, David Rajchenbach-Teller wrote:
What's the difference between |scope| and Rust's resources, exactly?

"scope" would be executed unconditionally at the end of the current block, while the rules for standard Rust RAII are somewhat more complex and depend on the initedness of the variable, whether it was moved, etc. There's a hidden dynamic flag created by the compiler and set

I've been toying with the idea of changing standard Rust RAII to "execute this when the variable goes dead" (in the classic compiler liveness sense) and introduce a "scope" keyword for something more like C++ or D RAII in which the liveness of the variable is restricted to be exactly the extent of the block, making it safe to unconditionally run the destructor once the variable goes out of scope.

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

Reply via email to