All of the collections in the former collections crate use the front/back naming convention, but slice uses a first/last naming convention. I doubt that deprecating the former is a good idea at this rate, but it's worth talking about— should the methods first/last, first/last_mut, split_first/last be renamed to front/back, or should it go the other way?
Iterator also uses last; meanwhile DoubleEndedIterator has next_back.
I'm quite curious of people's opinion on this.
In any case, other languages:
so... I dunno.
I think I prefer doubling down on front/back, but I also have some amount of C++ influence.
I like front/back slightly better because they naturally extend to other APIs like next_back where you need to specify just a "direction" and not an "endpoint" the way first/last do.
I am mostly influenced by C++ and Javascript, though I'm not about to suggest the latter because it's kind of insane on this issue:
C++ names are lovely, but my standard is that the names must be actively harmful to correctness of programs or harmful to adoption of Rust to warrant renaming of oft-used API. (And this does not seem to reach that level.)
Hmm, in C++ v.push_back(x) and v.insert(v.end(), x) are synonyms, but don't use the same word either.
I wonder whether there's a consistent (and possibly useful) interpretation here where first and last are elements, whereas front and back are insertion points (aka fenceposts, like "past-the-end" in C++).
@bluss I mean, it's just slice that uses first/last; collections uses front/back. That's the issue, the inconsistency is confusing.
Most helpful comment
Hmm, in C++
v.push_back(x)andv.insert(v.end(), x)are synonyms, but don't use the same word either.I wonder whether there's a consistent (and possibly useful) interpretation here where
firstandlastare elements, whereasfrontandbackare insertion points (aka fenceposts, like "past-the-end" in C++).