On Wed, Jan 29, 2014 at 8:31 PM, Haoyi Li <[email protected]> wrote:
> Sorry to parachute in to the conversation (long time lurker) but just to > add to the statistics, the Scala standard library and compiler has > 11875:54575 ratio of mutable (var) vs immutable (val) declarations, so it > seems to match pretty well with the numbers you guys are seeing in the rust > libraries. > > 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. -- Ziad
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
