Every system that serves human intent must be able to identify "which one" and recognize "the same one."
I’m going to assume your intentions are good, but I fear AI has substantially misled you. For one, Vec is not in core, and what you’re describing could at best be in alloc. Second, people can easily implement interning in library crates; for instance, rustc itself implements and uses interning. I also found this crate from a quick search: internment
Rust is extremely likely not going to add this to alloc or std when structures that implement interning:
- are not widespread “vocabulary types”,
- do not need special language support (they can be implemented in libraries),
- libraries for the structure don’t have hundreds of millions of downloads and pressure from users to add the types to
std, as with past cases where stuff was added tostd.
Personally, I have never felt a gap from lack of interning in std.
Andyou007:
List<T>— fixed-width unit store, addressed byusizeidentityVariableList<T>— variable-width unit store, same identity model, with interning supportBoth are small enough to copy into a project without installing a crate.
Maybe this is a gap in expectations, but it’s extremely normal for Rust crates to pull in a lot of other crates as dependencies.
Discussion in the ATmosphere