3 ms·
> The memory safety stuff is 90% writing safe code then fighting the compiler to agree with you. This isn’t my experience, from a decade of occasionally watchi
by chrismorgan 3y ago
> The memory safety stuff is 90% writing safe code then fighting the compiler to agree with you.
This isn’t my experience, from a decade of occasionally watching and helping others learn Rust, personally and professionally. Rather, it’s normally writing code that you believe is safe, wrestling with the compiler and finally realising that it was right all along, or giving up before reaching this stage but it was still. There are certainly some cases where this isn’t the case, and this article talks about the most common and most notorious one, but seriously, the compiler is normally right.
Somewhere along the way, things click and your intuitions subsequently almost always match the compiler’s, and you have a much happier time of it, seldom needing to wrestle. And your coding in other languages tends to improve, or at least focus on ownership more in ways that tend to make later maintenance easier.
- kstrauser 3y agoMe, writing a thing in Python: La, la-la, la-la. Me, writing it in C: Grumble, grumble, la-la-la. Me, writing it in Rust: I HATE THIS THING WHY DO YOU oh hey I'd been thinking about this all wrong. I go through that cycle all the freaking time. At first, I'm irked that Rust is being such a pain in the neck. Then I give in and do things the way it wants me to, and realize that it's genuinely much better that way, even if I then take that approach back to Python. At the least, now I'm more aware of when I'm counting on the garbage collector to atone for my sins.
- 4death4 3y agoYour “experience” (bias?) is easily falsified. Obviously memory issues happen all the time in unsafe languages, but even then, not nearly at the frequency that a novice Rust user will conflict with the borrow checker. The article we’re commenting on is literally about safe code that the borrow checker fails on.