Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-07-03 12:17:19


All the changes mentioned below leave the current names in place as
synonyms, so will break no existing code.

* Change is_regular() to is_regular_file().

Dave Abrahams and several other people, including me, have found that
the name of the is_regular() function is too obscure. It was chosen over
is_regular_file() for brevity, but isn't holding up well with
experience. The status name is already "regular_file" and the term
"regular file" is used by the POSIX standard.

* Change leaf() to base_name().
* Change branch() to base_path().

In the long thread '[filesystem] "leaf"', several people found the
current names obscure or invoking the wrong metaphor. Many alternative
names were discussed, with an eye to making the names more obvious,
conforming to names such as "basename" used in other programming
languages, and/or using names already in use by the STL. Not breaking
existing code was also a major concern, given that "basename" is already
used in Boost.Filesystem.

The mental model for the new names is that for a path, p:

    p == p.base_path() / p.base_name()

Thus if p == "foo/bar/boo.txt", p.base_path() == "foo/bar", and
p.base_name() == "boo.txt".

* Change basename() to base_name_prefix().
* Change to extension() to base_name_extension().

This change is to avoid confusion with base_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)

Thus if p == "foo/bar/boo.txt", base_name_prefix(p) == "boo", and
base_name_extension(p) == ".txt".

Comments?

--Beman


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