Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Linus has commented that using C may eventually be an obstacle to attracting new contributors. Rust is attracting new developers and gaining mindshare. From Rustaceans' perspective C looks tedious and antiquated — not fun to work on.


Really? Is this the same Linus that has commented that he likes the fact that C turns people off, because people who get turned off that easily probably don't have the grit to contribute to the kernel, and so he doesn't want them anyway? (paraphrasing)


There's a difference. One comment was about having a language that will scare away amateurs, the other was about having a language that will not scare away valuable contributors.

Besides, fighting with the borrow checker requires a lot of grit ;)


I don't know anything about Rust, but I've heard about fighting the borrow checker.

I wonder - doesn't that mean that either the borrow checker is a bit shit, OR you're systematically doing something wrong and don't realize it?


The truth is definitely some mix of both of those things. There are cases where the borrow checker can't understand some code that everyone can agree should be allowed, and maybe a larger set of cases where there's some debate about what should be allowed. The 1.0 compiler was substantially worse about this, and the introduction of "nonlexical lifetimes" in 2018 was a major improvement, though there's still plenty more to do.

One of the reasons that "fighting the borrow checker" is such a common experience, is that it can be hard to tell the difference between cases like "this doesn't work because you forgot a small piece of syntax" vs "this doesn't work because you need a special helper type to make it work" vs "this doesn't work because fundamentally Rust will never allow this to work". For example, sharing objects between two threads often requires the `Arc<Mutex<...>>` pattern, which is a combination of two different helpers, and beginners who've never seen that combination before are very unlikely to discover it on their own. But once you have some experience with common patterns, and you know how to avoid writing code that will fundamentally never work, compiler errors are much more likely to be helpful.

A lot of people ultimately decide that "the compiler was right all along" and that their code is really better now that they've learned to satisfy the borrow checker. Personally, I think learning how to write Rust code is a helpful shortcut to learning how to write safe and correct C/C++, because the "borrow checker in your head" pushes you towards designs that work well in all three languages. But this is definitely a matter of opinion, not to mention extreme selection/survivorship bias, etc.


Both. The borrow checker encodes a lot of rules and habits which experienced C and C++ developers tend to develop anyway, because breaking those rules tends to result in bugs (and people who learn rust often report that it makes them better C/C++ programmers). But it is possible to break those rules and get away with it in ways which the borrow checker is unable to verify, and unsafe blocks exist in part to allow you to do so if you're really sure you're right (though frequently beginners are not).


Well, he certainly won’t lose that by switching to rust judging by the comments in this thread!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: