3 ms·
The borrow checker is also what I like the least about Rust, but only because I like pattern matching, zero-cost abstractions, the type system, fearless concurr
by airstrike 1y ago
The borrow checker is also what I like the least about Rust, but only because I like pattern matching, zero-cost abstractions, the type system, fearless concurrency, algebraic data types, and Cargo even more.
- School-Cotton 1y agoFearless concurrency is only possible because of the borrow checker.
- ameliaquining 1y agoThis isn't really right; Pony does static concurrency safety without borrow checking, and while Swift sort of has borrow checking it's mostly orthogonal to how static concurrency safety works there. The relationship between borrow checking and concurrency safety in Rust is closer to "they rhyme" than "they use the exact same mechanism".
- airstrike 1y agoThanks for all your clarifying comments. I appreciate them and have learned lots. If you have a blog, I'd love to read whatever you write.
- tialaramex 1y agoYou've provided reasons why other languages have other properties, but Rust's fearless concurrency requires borrow checking. The concurrency focused trait Send only makes sense because we have control over references, through the borrow checker. Thread #1 can give Thread #2 this Doodad because it no longer has any references to it, if you try to give it a Doodad you're still referring to, then the borrow checker will reject your code. The Send trait guarantees that this (giving the Doodad to a different thread) is an OK thing to do - but only if you don't have outstanding borrows so you won't be able to look at the Doodad once you give it to Thread #2
- deleted 1y ago[deleted]