Today someone asked in OCaml’s Discord “How do you call a variable that refersto a filename without its extension?”. I always thought there was no specificterm for this and I always named such variables filename-sans-extension (orsimilar), but it turns out I was wrong. It’s never too late to learningsomething new! But first a bit of (subjective) terminology:

  • /path/to/some\_file.foo - filepath
  • /path/to - directory
  • some\_file.foo - filename/basename
  • foo - extension
  • some\_file - ???

I hope that makes things clear. Now we can proceed!

So what’s the term we’re looking for? Turns out it’s stem and it’s present in a few popular programming languages:

If I had to guess - probably it originated with C++. If someone knows the originof the stem terminology, please do share! At any rate - I kind of like it andI’ll probably use stem or the more descriptive file\_stem going forward.

That’s all I have for you today. Keep hacking!