News for hackers. Stuff that matters.
Re:Thoughts on Rust, a few thousand lines in by StreamBright on Wednesday January 09, 2019 @04:19PM (#18869006)
But how do you know just by reading that code? It would not be obvious to me at all.
Re:Thoughts on Rust, a few thousand lines in by bryal on Wednesday January 09, 2019 @04:28PM (#18869091)
I think it's quite fine to assume the reader knows enough rust to know the difference between mutable and immutable variables.
Re:Thoughts on Rust, a few thousand lines in by empath75 on Wednesday January 09, 2019 @04:36PM (#18869181)
let foo = bar; let foo = bat;

is shadowing

let foo = bar; foo = bat;

is a compilation-time error because foo isn't mutable.

let mut foo = bar; foo = bat;

is reassignment.

in working code, either foo is declared as mutable or it's not, and it's pretty obvious from the code what's happening.

Re:Thoughts on Rust, a few thousand lines in by StreamBright on Wednesday January 09, 2019 @05:12PM (#18869507)
I guess. I would just never write code like that.
Re:Thoughts on Rust, a few thousand lines in by goto11 on Wednesday January 09, 2019 @04:25PM (#18869061)
You mean if you don't know the language?
Re:Thoughts on Rust, a few thousand lines in by StreamBright on Wednesday January 09, 2019 @05:12PM (#18869503)
I guess I just need to learn Rust. I wouldn't write a style of code where I have 3 lets after an other and using the same variable name.
Re:Thoughts on Rust, a few thousand lines in by hamaluik on Wednesday January 09, 2019 @04:52PM (#18869325)
I guess if you don't know rust you might not? But one of the first things you learn about rust is the `mut` keyword.
Re:Thoughts on Rust, a few thousand lines in by eximius on Wednesday January 09, 2019 @08:09PM (#18870662)
`let` rebinds. If there isn't a `let`, it's mutation.