Stable type identifiers: a missing piece for crABI and export
The main use case I have in mind is plugins and dynamic Rust-to-Rust linking. In that case, nominal typing is safer; if you load a plugin that exports a type, you want to know exactly what that type is, not just any struct with the same fields. Semantic identity matters.
With structural typing, you could load a structurally compatible but semantically incorrect type without detecting it until runtime.
That said, I understand there are cases where structural typing would be useful; moving types between modules without breaking the ABI, for example. For those cases, an explicit annotation like #[abi_structural] could be the solution, similar to how #[repr(C)] already works today; nominal by default, opt-in for special behavior.
Regarding the pkgid issue you mentioned, you’re right; crate names aren’t sufficient, and we’d need to include something equivalent to Cargo’s pkgid to resolve ambiguity.
Discussion in the ATmosphere