4 ms·
Does Rust define collection traits for abstract interfaces like Set, Map, and Queue like Java's Collections interfaces? I don't see any in the std::collections
by cpeterso 10y ago
Does Rust define collection traits for abstract interfaces like Set, Map, and Queue like Java's Collections interfaces? I don't see any in the std::collections documentation. Standardizing those APIs in the std lib seems as (or more!) important than providing concrete implementations like BTreeMap. I see some 2015 discussion about missing collections traits:
https://internals.rust-lang.org/t/collection-traits-take-2/1272 https://internals.rust-lang.org/t/collection-traits-take-2/1...
https://internals.rust-lang.org/t/traits-that-should-be-in-std-but-arent/3002 https://internals.rust-lang.org/t/traits-that-should-be-in-s...
For comparison, here are Java's core collection interfaces: Collection, Set, SortedSet, List, Queue, Deque, Map, and SortedMap.
http://docs.oracle.com/javase/tutorial/collections/interfaces/index.html http://docs.oracle.com/javase/tutorial/collections/interface...
- steveklabnik 10y agoIIRC, we need higher kinded types before we can create a truly great set of generic collections traits.
- mafribe 10y agoAre higher-kinded types scheduled for inclusion? If so when?
- steveklabnik 10y agoThey're at the "nobody has yet to come up with a serious proposal" stage. Some are skeptical that they can ever fit in. We'll see.
- mafribe 10y agoThanks. Do you know who is working on this? I'd like to talk with them.
- steveklabnik 10y agoI'm not aware of anyone seriously pursuing it yet.
- maxbrunsfeld 10y agoI'm curious about why higher-kinded types are needed for this. I'd have thought that it would be possible to create these kinds of traits in rust's current type system. Is there someplace I could read more explanation on this?
- steveklabnik 10y agohttps://github.com/rust-lang/rfcs/blob/4b4fd5146c04c9c284094aad8f54ca5c2093c7f2/text/0235-collections-conventions.md#removing-the-traits https://github.com/rust-lang/rfcs/blob/4b4fd5146c04c9c284094...
- deleted 10y ago[deleted]