News for hackers. Stuff that matters.
Re:Comparison between Rust and D by yokohummer7 on Saturday June 25, 2016 @01:49PM (#11977211)
It doesn't have the same semantics, because even after introducing the new variable, it is still immutable. So you cannot accidentally modify the new variable. e.g.,

  let x = 1;
  let x = x + 1;
  x = 99; // Error: you can't accidentally modify the immutable variable `x`

  let mut x = 1;
  x = x + 1;
  x = 99; // Ok
You can even turn back a mutable varaible into an immutable variable, like this:

  let mut x = 1;
  x = x + 1;
  let x = x;
  x = 99; // Error: `x` became immutable
This can be useful to "pin" the variable after a large number of calculations done to it.

There are no comments on this comment yet.