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

Speaking as a C++ developer on GPUs, it's mostly the first.

There's so many problems that no other language has due to the backwards compatibility guarantees Bjarne made to get companies using the language.

For example, C guarantees ABI compatibility. Object files from an older compiler/standard can be linked with newer versions of the compiler/standard. This is great if you want to distribute a proprietary library to end-users without revealing source code (libcuda & legacy enterprise tools).

But this guarantee applied to C++ means a templated function in the standard library can almost never change the implementation.

As a result of extending the guarantee to templates, the C++ standard library must create new classes and functions then deprecate the old ones, meaning they can't do basic optimizations to older code. A big complaint is "too many ways to do the same thing".

Rust doesn't make this guarantee.

That allows them to make a cleaner language with less duplication, but mostly forces Rust crates to be open-source.

Nvidia shipping libcuda.so in Rust means having to upgrade Rust constantly and potentially forcing customers to, or releasing the CUDA source code which hurts their competitive advantage.

Bjarne could've designed a number of OOP languages in the 70s and 80s. Smalltalk, Eiffel, and Simula, were better languages. But he built C with classes which is the reason it's used today.



> But this guarantee applied to C++

It actually doesn't. There's nothing in the standard about it; it's up to compilers. See https://stackoverflow.com/questions/46746878/is-it-safe-to-l...

> but mostly forces Rust crates to be open-source.

In practice how many closed source C++ libraries are there? I can't recall using a single one despite working on many closed source C++ applications. I'm sure they exist but a closed source Rust crate could just do what many C++ libraries do anyway - wrap a C ABI with a thin open source Rust shim.

> which is the reason it's used today.

Obviously it helped that C++ was backwards compatible with C, but all of those languages you mentioned use garbage collection and need some kind of runtime so they were never in the running for a systems programming language like C++. (I know "systems programming" is ambiguous but you know what I mean...)

I totally agree that the requirement of backwards compatibility with C made C++ a lot shitter. The most obvious examples are the automatic type coersion and the insane type syntax.




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

Search: