Hacker News new | ask | show | jobs
by loeg 38 days ago
I agree momentum for Rust is growing, but disagree that it is obvious the writing is on the wall for C++. Like, Java and C# didn't kill C++, either. In all likelihood, these languages will all coexist for a long, long time.
2 comments

Java and C# did kill C++. They just did it only in places they were feasible. People forget that before them, it was very common to write application and even serve code in C++. Now Rust is targeting its remaining niche(s).
Yes, at least Rust and Zig have answers for the remaining niches.

Rust's type system is making it's compile times bigger than C, C++ and Zig. This does keep it away from some code that's currently C or C++.

This is a common misunderstanding. Rust’s type system and borrow checker are not significant reasons for its compile times, and Rust compile times aren’t really worse than equivalent modern C++ code.
Not sure what you mean by modern C++ code.

But Rust's type system an borrow checker are not something you want to go without in Rust, while in C++ many codebases prevent the use of some features to reduce compile time right?

Modern C++ is characterized by relying on templates for generics and reusability, as well as static dispatch.

“Traditional” C++ looks a lot more like Java, and often like C.

Much of the compile time of both Rust and C++ comes from monomorphization and linking, both of which do a lot of work to support the zero-cost high-level abstractions favored by both languages.

You said:

> Rust’s type system and borrow checker are not significant reasons for its compile times

But isn't "hard" monomorphization a property of more complex type systems (generics, type variables, etc.)?

Game companies are one example were server code is still mostly C++.
1.5 billion lines of Cobol are still written per year.