News for hackers. Stuff that matters.
Re:Stop Making Me Memorize the Borrow Checker by Pannoniae on Saturday November 16, 2024 @08:08PM (#42161088)
Fair enough, but the problem in this analogy is that this learning isn't always useful or productive in any way. This is more like doing arithmetic in a sort of maths notation where every result must be in base 12 and everything else must be in base 16. Sure, you can memorise the rules and the conversions but you aren't doing much useful with your life at that point.

Obviously, the borrow checker has uses in preventing a certain class of bugs, but it also destroys development velocity. Sometimes it's a good tradeoff (safety-critical systems, embedded, backends, etc.) and sometimes it's a square peg in a round hole (startups and gamedev where fast iteration is essential)

Re:Stop Making Me Memorize the Borrow Checker by Aurornis on Saturday November 16, 2024 @08:14PM (#42161120)
I don’t understand your analogy at all. The borrow checker doesn’t feel like doing math in base 12 once you internalize the rules. It should come as second nature for 95% of programming work, with the last 5% requiring some planning ahead that probably should be done anyway in a properly written program.
Re:Stop Making Me Memorize the Borrow Checker by kstrauser on Saturday November 16, 2024 @08:23PM (#42161179)
I think it destroys productivity if and only if you don’t roll with it and do things the Rusty way. If you write code with its idioms, it can be a huge productivity boost. Specifically, I can concentrate on fixing logic errors in my code instead of resource bookkeeping. When I refactor something, I know I didn’t accidentally forget to move alloc/free to the appropriate places for the new code: if my changes broke something, it’ll tell me.
Re:Stop Making Me Memorize the Borrow Checker by Aurornis on Saturday November 16, 2024 @08:26PM (#42161194)
Rust shouldn’t “destroy development velocity” once you’ve grasped the core concepts. There is some overhead to being explicit about how things are shared and kept, but that overhead diminishes with time as you internalize the rules.
Re:Stop Making Me Memorize the Borrow Checker by tsimionescu on Sunday November 17, 2024 @01:35AM (#42162391)
Not if you're iterating and have to make fundamental changes. Just like certain advanced type systems, encoding too much at compile time means you have to change a lot of code in unnecessary mechanical ways when the design constraints change, or when you discover them.

This is not a bad thing by the way, it's an extremely plausible design chocie, and is one that Rust made very clearly: rejecting not-entirely-correct programs is more important than running the parts that do work. Languages that want to optimize for prototyping will make the opposite choice, and that's fine too.