But yeah, otherwise, awesome.
But yeah, otherwise, awesome.
// We do this:
let point = Point { x: 2, y: 4 };
let point = Point { x: 4, ...point };
and let point = Point { x: 2, y: 4 };
point.x = 4;
And that's generally what the problem is with mutable variables. You either erroneously assume `x == 2`, or have to read all the code between assignment and the point you're trying to change something.Immutability gives you less thinking and parsing overhead. This kind of defeats that purpose.
Shadowing is one of those things that intuitively raises a red flag first time you see it but actually is extremely helpful. It dramatically reduces noise e.g. in functions where you take an input parameter and want to convert it to a different type to work with it. No more prefixing or suffixing the variable name, you just rebind it which makes the intent clear (at least to me).
From personal experience, this also makes it easy to set up `let y = f(g(x))` as easily reorderable or printf-debuggable statements in the form of `let y = x; let y = g(y); let y = f(y);`
Mutability is much restricted and the use of traits make conversions much easier.
I think the best of rust is inmutability + From trait + Into Trait. Combined are great.