Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-05-21 02:19:25


on Tue May 20 2008, dizzy <dizzy-AT-roedu.net> wrote:

> On Monday 19 May 2008 23:37:25 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.
>
> Correct.
>
>> 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?
>
> But it's not the directory itself (identified by some path object) that is a
> leaf, it is the path component returned by leaf() that is the leaf of
> a path.

Paths don't have leaves. They have beginnings, endings, and middles.
They are linear.

> Because I assume you talk about basic_path::leaf(). For any given path, the
> path components form the path tree

Ok, technically a -> b -> c -> d is a tree, but it's a degenerate tree.
That's not a very useful view, and just complicates everything conceptually.

> and the last component is the leaf of that tree respecting the
> semantics you described. It's not a leaf node in another context,

It's not a leaf node in any context other than in the subtree of the
actual directory tree that only consists of the listed path components.

> but there is no such context implied since we are talking about
> basic_path::leaf(), ie a path leaf not something else's leaf.

That logic sounds a bit circular to me. Maybe I'm missing something.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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