top | item 47126930

(no title)

jjmarr | 6 days ago

C++ ABI stability is the main reason improvements to the language get rejected.

You cannot change anything that would affect the class layout of something in the STL. For templated functions where the implementation is in the header, ODR means you can't add optimizations later on.

Maybe this was OK in the 90s when companies deleted the source code and laid off the programmers once the software was done, but it's not a feature Rust should ever support or guarantee.

The "stable ABI" is C functions and nothing else for a very good reason.

discuss

order

pizlonator|6 days ago

I think if Rust wants to evolve even more aggressively than C++ evolves, then that is a chasm that needs to be crossed.

In lots of domains, having a language that doesn't change very much, or that only changes very carefully with backcompat being taken super seriously, is more important than the memory safety guarantees Rust offers.

jjmarr|6 days ago

In my view, this is a good thing.

As a C++ developer, I regularly deal with people that think creating a compiled object file and throwing away the source code is acceptable, or decide to hide source code for "security" while distributing object files. This makes my life hell.

Rust preventing this makes my life so much better.

SkiFire13|6 days ago

C++ is still changing quite a lot though, just not in ways that fix the existing issues (often because doing so would break ABI stability).

PunchyHamster|5 days ago

I think it's the domains that need to evolve, because the effects of that approach have been very bad for a very long time already

Gigachad|6 days ago

Isn’t this solution solved by just compiling your libraries with your main app code? Computers are fast enough that this shouldn’t be a huge issue.

ozgrakkurt|5 days ago

In what way rust needs to evolve? It seems pretty evolved to me already but I’m no language expert

dpc_01234|6 days ago

What's the stat of single-compiler version ABI? I mean - if the compiler guaranteed that for the same version of the compiler the ABI can work, we could potentially use dynamic linking for a lot of things (speed up iterative development) without committing to any long term stable API or going through C ABI for everything.

nicoburns|5 days ago

I think the way to fix this is:

1. Have the stable ABI be opt-in similarly to how the C ABI is opt-in in Rust (`#[repr(stable)]` or similar)

2. Have the stable ABI be versioned. So it would actually be `#[repr(stable_2026)]` or whatever

pjmlp|6 days ago

The big question is does Rust want to play being adopted by those vendors, or it would leave them alone with languages that embrace native libraries.