Boost logo

Boost :

From: Vladimir Prus (vladimir_at_[hidden])
Date: 2008-07-03 13:37:45


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'?

> 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".

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk