← Back to context

Comment by umanwizard

10 months ago

Why does disliking C++ make it odd that he is open to Rust? C++ is uniquely bad; disliking it doesn’t necessarily mean you only like C.

C++ garnered a similarly enthusiastic following in the 1990s as Rust has in recent years. Not only was it “a better C”, but it allowed to build safe and zero-cost abstractions with a rich type system in a way that C couldn’t. (At least that’s what many C++ programmers believed then. It turned out to not be quite zero-cost after all, and exception safety proved to be highly non-trivial.) Details aside, there is a large overlap in mindset between those favoring Rust today with those favoring C++ in the 1990s. And the complexity of many Rust libraries today is eerily reminiscent of the complexity of C++ template-based libraries back then. So I can see why someone might find it odd.

  • Okay, that is a fair point. I think the difference though is that while C++ indeed mitigated some of the drawbacks of C, it did so while also introducing a huge amount of additional complexity and dubious features, which you could also argue Rust does, but I think not nearly to the same extent.

    • Hindsight is 20/20. It wasn’t perceived that way back then. Every C++ feature had a well-reasoned rationale of solving an important problem. (I found the book “The Design and Evolution of C++” worth reading, although that was some time ago.) The only handicap requiring compromises was backwards compatibility with C, but that was also a major reason why it became so successful.

      I’m sure that Rust will continue to become more complex, and in 20–30 years another systems language will likely come along that is at least as safe while being easier to work with again.

At this point you have a community of maintainers who expect it to remain a C project.

Which is very logical. If you add Rust, why not Zig, Nim, and every other low level language?

  • I can't find the exact link now (very well might have been a video without a searchable transcript), but I recall someone asking Linus that (specifically re his previous comments on C++), and his answer was something like he saw Rust solving a problem that C genuinely does not. It's controversial, but I do think of C++, Zig, etc as solving the "same problems" as C (perhaps in a much nicer way)

    • His particular opinion doesn't matter if the rest of the old guard only wants C in the kernel.

      A lot of pain and drama could of been prevented if he put his foot down and said only C code is allowed. Instead he left it ambiguous, and a lot of good meaning people have been damaged by this. I know I'd be upset if I had been a part of the Rust for Linux team, and when I actually wanted to get my code in I was told my contributions weren't welcomed.

      I wouldn't want to mix and match languages in a project that's so vital to really the entire world. It just seems like a good way for a funky rust bug to cause billions in issues...