Boost logo

Boost :

From: Johan Råde (rade_at_[hidden])
Date: 2008-05-21 09:11:27

Beman Dawes wrote:
> Johan Råde wrote:
>> 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." I wonder if this is the best possible name?
>>> 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.
>> David is absolutely right.
>> The name leaf is the result of conceptual confusion,
>> failure to distinguish between the tree structure of the file system
>> and the linear structure of a path.
>> If possible, at this late stage, the names should be changed.
> Why don't you and Dave come up with a proposed set of names? The current
> names are:
> root_path
> root_name
> root_directory
> relative_path
> leaf
> branch_path
> basename
> extension

I think all these names are fine except "leaf" and "branch_path".
If anyone asked me "What does the function branch_path return?",
I would answer "The parent directory."
So why not call it parent_directory_path?


Boost list run by bdawes at, gregod at, cpdaniel at, john at