Re:The borrowchecker is what I like the least about Rust
by someone_19 on Monday July 21, 2025 @11:48AM
(#44636612)
My first thought when I was learning Rust was "Why don't they use a different operator for move?", something like:
let a <= String::from("Hi");
let b <= a;
let j = 0; // Copy
let k = j;
This may not be convenient, but it could be useful for educational purposes.
Re:The borrowchecker is what I like the least about Rust
by steveklabnik on Monday July 21, 2025 @12:28PM
(#44637095)
A long time ago, you would use the move keyword for this. The issue is that it’s just redundant, so it feels like unnecessary boilerplate.
Re:The borrowchecker is what I like the least about Rust
by someone_19 on Monday July 21, 2025 @01:04PM
(#44637570)
...and using it in function calls would also be inconvenient.
Now I have a clear understanding of what is happening and how.
Nevertheless, using something like this for educational purposes maybe could help. Author of the article In the example with Id literally complains that moving makes moving.
If you try to write Java in Rust, you will fail. Rust is no different in this regard from Haskell, but method syntax feels so friendly that it doesn't register that this is a language you genuinely have to learn instead of picking up the basics in a couple hours and immediately start implementing `increment_counter`-style interfaces.
And this is an inexperienced take, no matter how eloquently it's written. You can see it immediately from the complaint about CS101 pointer-chasing graph structures, and apoplexy at the thought of index-based structures, when any serious graph should be written with an index-based adjacency list and writing your own nonintrusive collection types is pretty rare in normal code. Just Use Petgraph.
A beginner is told to 'Just' use borrow-splitting functions, and this feels like a hoop to jump through. This is because it's not the real answer. The real answer is that once you have properly learned Rust, once your reflexes are procedural instead of object-oriented, you stop running into the problem altogether; you automatically architect code so it doesn't come up (as often). The article mentions this point and says 'nuh uh', but everyone saying it is personally at this level; 'intermittent' Rust usage is not really a good Learning Environment.