3 ms·
This is done so that the programmer doesn't have to reason about it. Polonius makes the compiler accept code that's obviously valid, but the current borrow chec
by mibsl 3y ago
This is done so that the programmer doesn't have to reason about it. Polonius makes the compiler accept code that's obviously valid, but the current borrow checker isn't sophisticated enough to declare it as safe.
I've bumped into this kind of problem when writing rust, at first it was hard to understand why the compiler doesn't accept my code.
- FpUser 3y agoThis kind of control would drive me up the wall. If I write code and my logic is wrong I appreciate compiler being able to tell me to sod off. Doing it when the logic is perfectly valid is a turn off.
- vacuity 3y agoThat's the draw of having a borrow checker, which is arguably the contributor to the biggest pain points of Rust. Everything is a tradeoff. Rust's "unsafe" blocks are also a tradeoff. To my understanding, Rice's theorem ensures that, for checking borrows, either all invalid programs and some valid programs are rejected, or all valid programs and some invalid programs are accepted. Given Rust's goal of overall safety, the conservative route (which rejects some valid programs) is favored.
- FpUser 3y ago>" the conservative route (which rejects some valid programs) is favored." I understand it and consider it very reasonable choice given the goals. Still no fun ;)
- hollerith 3y agoSome languages require you to declare your variables, and if you use an undeclared variable, the compiler complains and refuses to emit any code. Is that a turn off for you, too?
- FpUser 3y ago>"Is that a turn off for you, too?" Quite the opposite