On 1/29/14 11:47 PM, Ziad Hatahet wrote:
That's interesting. However, Scala's `val` is the equivalent of Java's `final`, and does not imply "total" immutability. For non-primitive types, it only means that the reference is fixed to being bound to a specific object. It does not mean that that object itself is immutable (unlike Rusts `let`, or C++'s `const*`/`const&`). It is better than nothing, but it does give a false sense of security at times. I really wish more languages adopted Rust's way of doing immutability (I think D does something similar); I wonder why it never caught on in the more popular languages.
Rust's immutability setup depends on uniqueness, which is fairly, well, unique to Rust. (C++ has something similar with auto_ptr and unique_ptr, but the compiler knows nothing about it and "const" predated those anyhow.)
Patrick _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
