From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-07-04 09:38:30
Vladimir Prus wrote:
> Beman Dawes wrote:
>> * Change leaf() to base_name().
>> * Change branch() to base_path().
> I don't think that's very clear. In POSIX, you have dirname + basename,
> so the model is that file path is "directory + base". What is the
> meaning of "base" in "base_path"? If you have something named 'base',
> then you must have something that can be added to base to produce
> something bigger. But it appears that everything is now called 'base_xxx'.
> Looking at Java, the File class has the getParentFile() method, which
> seems fairly obvious. It also has 'getName()' method that returns
> last component of the path.
> Looking at Qt, the QFileInfo class provides path() and fileName() methods
> that add up to complete path. The baseName() method returns part of fileName
> until the first dot -- and there are functions to get suffix -- suffix()
> and completeSuffix(). The path() method returns QString, and there's
> dir() method that returns QDir.
> Why don't we borrow those examples and use 'directory' + 'name'?
To me, "directory" implies a single directory name rather than a path.
That's always been a gripe of mine when looking at other systems.
But I do think the very similar 'path' + 'name' approach is what we are
>> The mental model for the new name is that for a path, p:
>> p.base_name() == base_name_prefix(p) + base_name_extension(p)
> Does this actually add up? My mental model of "prefix" is that
> you have prefix, followed by stem, followed by suffix. You have
> no stem, and have extension instead of suffix. It probably should
> be "stem" + "suffix", or "core" + "extension", or, well
> "basename" + "extension".
"stem" is an interesting suggestion. For "word stem", Wikipedia says "In
linguistics, a stem (sometimes also theme) is the part of a word that is
common to all its inflected variants." That pretty much describes the