Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-05-20 09:33:14


David Abrahams wrote:
> I was just reviewing the filesystem docs and came across "leaf()". I'm
> sure this isn't the first time I've seen it, but this time I picked up a
> little semantic dissonance. Normally we think of "leaf" in the context
> of a tree as being a thing with no children. An interior node like a
> directory that has files or other directories in it is usually not
> called a "leaf."

Right. And "leaf" never returns an interior node of a path.

> I wonder if this is the best possible name?

The names used by the filesystem library were carefully chosen as a
matched set. So you can't change a single name without making a
corresponding change to the other names (like "branch") it is related to.

> Is there a precedent we can draw on in some other language/library? In
> python, it's os.path.basename(p). Perl, php, and the posix basename
> command seem to do something similar.

The filesytem names were chosen to be an improvement over the naming
used by other libraries and/or languages, which always seemed to me to
be misleading. For example, my intuition is that basename("foo.bar")
should yield "foo", not "foo.bar".

--Beman


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