So there is this comment in the 1.0.0-alpha announcement thread in /r/programming, which points out that Rust’s std collections have inconsistent names.
I’ll admit that before seeing this comment, I didn’t give much thought to these names. But now I do believe that there are inconsistencies in the names.
The corrent names (and their “fuller” versions) are:
The abbreviation rules do seem a bit inconsistent here. (Sometimes the first (and second) word is abbreviated, sometimes the last. However there are also cases where the names are not abbreviated.) So how do we fix this?
Changing all abbreviated names to their full versions are not practical. For one, we do not want to break the world again, and
Vec is so frequently used that it deserves a shorter name, Then, if we have one abbreviated name, it is natural to have others.
But people will say “we get that, but the rules are so inconsistent. Why are [some collection names] abbreviated [in some way], not [in some other way]?”
The way I see it, we actually do have a consistent abbreviation rule:
Each word in the names must be shorter than or equal to four letters, or they should be abbreviated.
There seem to be exceptions:
Bitvcan be seen as short for
BitVector, so it actually confirms to the rule.
- Ditto for
DListshould be either
DoublyLinkedList, as all the “middle grounds” feel unnatual. We don’t want the full one because it is too long (and more importantly, we already use other abbreviated names), so the most abbreviated one is the best choice here.
Thus, I believe the only serious offender is
BinaryHeap. Maybe we should rename it to
Of course this is bikeshedding and stable names are not expected to be changed (and honestly I don’t quite expect this change to happen), but still, I don’t want Rust to give an impression as “the promising language that has strangely inconsistent naming conventions for its standard collections”.