News for hackers. Stuff that matters.
Re:Rust is the future, C is the new Assembly: Josh Triplett ... by jandrewrogers on Wednesday August 28, 2019 @01:27PM (#20821950)
The borrow checker is more problematic for systems software than you suggest. It is unable to express lifetime models that are essential for some types of systems software, forcing you to either litter your code with "unsafe" or to sacrifice significant amounts of performance. If performance is critical (it is for my use cases), and achieving that requires disabling memory safety, what other unique value does Rust bring to the table? That is a question to which I have been unable to find an obvious answer.

Complexity doesn't bother me (obviously, since I use C++ regularly) but lack of expressiveness is a big issue.

Re:Rust is the future, C is the new Assembly: Josh Triplett ... by steveklabnik on Wednesday August 28, 2019 @01:31PM (#20822006)
Sometimes, safety is faster than unsafety, because it lets you achieve algorithmic speedups in a more maintainable way. For example, Stylo, the new parallel rendering engine in Firefox, was attempted in C++ a few times. It failed each time. However, the project succeeded in Rust instead, and is much faster.

Additionally, the goal of unsafe is not to throw away all safety; it's to prove to the compiler something that you know, but it does not know. This means that you can contain the unsafety, and still gain the benefits as a user. The goal is to isolate and contain it, making it easier to write correctly.

Re:Rust is the future, C is the new Assembly: Josh Triplett ... by the_duke on Wednesday August 28, 2019 @01:46PM (#20822151)
I haven't done a lot of C programming myself, but I've heard very mixed opinions from C devs. Some say they hate the borrow checker because it introduces artificial constraints.

Others say that they love it because it enforces how they write their code anyway, but now with compiler checks that prevent them from messing up.

I think it's a fair criticism that the borrow checker is sometimes not powerful enough to understand a perfectly valid access pattern, but unsafe is always there if you know better.

More often than not (in my experience), the access pattern is not actually valid though, or risky and easy to mess up. And the compiler rubs your nose in a suboptimal design.

I've found that when I needed to reach for `unsafe`, I often could restructure the code instead to achieve a safe result with minimal performance loss.