I recently did some minor file name munging in Rust, and was reminded that one of the hard parts about learning a new language is the differences in vocabulary.
In UNIX, there are two command line tools,
dirname. They take a pathname as an argument and print a modified pathname to stdout, which is really handy for shell scripts. Several other languages copied that naming convention, and so I was really surprised to find that googling for
rust dirname didn’t return anything useful1.
Here’s a usage example: Say you have a pathname
/etc/ssh/sshd.config, if you use
dirname on it, that prints
sshd.config. Ruby, python, go all follow a similar pattern (ok, go calls its functions
Base). Rust does not - it calls them something else2.
These names make sense! They’re just way outside the range of vocabulary I’m used to.